Hi everybody,
I'm trying to fix the packaging of a very simple package, but some problem
show me that I have not well understood the whole mechanism
The structure of my package (some debug functions) is as follows:
python/
`-- dbg/
|-- __init__.py
`-- lib
|-- __init__.py
|-- debug.py
`-- gtk_dbg.py
my sys.path includes 'python' and I wanted that the content of debug.py was
simply included by: 'import dbg', so I wrote dbg/__init__.py as follows:
import os
Dir = os.path.dirname(__file__)
__path__ = [os.path.join(Dir, 'lib')]
from debug import *
It seems to work:
python$ python -c 'import dbg; print dir(dbg)'
['DBG', 'Dir', '__builtins__', '__doc__', '__file__', '__name__', \
'__path__', 'caller', 'debug', 'dshow', 'os', 're', 'show_caller', \
'sql_debug', 'sys']
BUT, if I set some variables they are not correctly seen:
import dbg
dbg.DBG = 1
function test included in debug.py raises NameError:
def test():
print DBG
NameError: global name 'DBG' is not defined`
What's happening? DBG seems to be set, as shown by dir(dbg)... any hints?
I'd also accept a hint for a different approch, if it's the case, but I'd
really would also understant this issue
Thanks in advance
sandro
*:-)
--
Sandro Dentella *:-)
http://www.tksql.org TkSQL Home page - My GPL work