Project

General

Profile

Bug #9701

'require' fails silently

Added by Attila Gróf over 6 years ago. Updated over 6 years ago.

Status:
Closed: invalid
Priority:
Medium
Category:
Lua
Start date:
12/01/2013
Due date:
% Done:

0%

Estimated time:
Affected Version:
git development version
System:
Ubuntu
bitness:
64-bit
hardware architecture:
amd64/x86

Description

I have the following code in luarc

dt = require "darktable" 
a = require "b" 

dt.print("Hello!")

If b.lua does not exist in .config/darktable or there is any error, then the require silently fails. I would expect similar stack trace as in case of problems with luarc. It is very tedious to divide code into modules and debug it.

darktable version used: 1.4-rc1

History

#1 Updated by Jérémy Rosen over 6 years ago

  • % Done changed from 0 to 20
  • Status changed from New to Incomplete

I get the following message on stdout :

LUA ERROR : ./configdir/luarc:11: module 'b' not found:
no field package.preload['b']
no file '/usr/local/share/lua/5.2/b.lua'
no file '/usr/local/share/lua/5.2/b/init.lua'
no file '/usr/local/lib/lua/5.2/b.lua'
no file '/usr/local/lib/lua/5.2/b/init.lua'
no file './b.lua'
no file '/usr/share/lua/5.2/b.lua'
no file '/usr/share/lua/5.2/b/init.lua'
no file './b.lua'
no file './share/darktable/lua/b.lua'
no file './configdir/lua/b.lua'
no file '/home/rosen/perso/darktable/darktable/tools/lua_doc/b.lua'
no file '/usr/local/lib/lua/5.2/b.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.2/b.so'
no file '/usr/lib/lua/5.2/b.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './b.so'

so it does work as you expect here... could you tell me a bit more about what you see ?

there is nothing special about the way we handle module loading, maybe you have a module that does something tricky with the "require" function... that's unlikely but possible...

#2 Updated by Attila Gróf over 6 years ago

  • % Done changed from 20 to 0
  • Status changed from Incomplete to Closed: invalid

I created this issue too early. I expected that packages work the same way as modules in Python, which is completely wrong. I need to learn how create packages.

Also available in: Atom PDF

Go to top