Re: confusion about package/module imports

2008-01-01 Thread Scott David Daniels
Jugdish wrote: > Thanks very much for your helpful response! > >> You'll see that b is executed (making module __main__), >> (1) it imports pkg.subpkg.a, >> (2) which is accomplished by importing pkg (successfully), >> (3)then by importing pkg.subpkg >> (4)

Re: confusion about package/module imports

2008-01-01 Thread Jugdish
Thanks very much for your helpful response! > You'll see that b is executed (making module __main__), > (1) it imports pkg.subpkg.a, > (2) which is accomplished by importing pkg (successfully), > (3)then by importing pkg.subpkg > (4) which imports pkg

Re: confusion about package/module imports

2008-01-01 Thread Scott David Daniels
Jugdish wrote: > Why doesn't the following work? > ... [well boiled-down code skipped] setenv PYTHONPATH $HOME:$PYTHONPATH python $HOME/pkg/subpkg/b.py > Traceback (most recent call last): > File "pkg/subpkg/b.py", line 1, in ? > import pkg.subpkg.a > File "$HOME/pkg/subpkg/__

confusion about package/module imports

2008-01-01 Thread Jugdish
Why doesn't the following work? >>> ls $HOME $HOME/pkg/__init__.py $HOME/pkg/subpkg/__init__.py $HOME/pkg/subpkg/a.py $HOME/pkg/subpkg/b.py >>> cat $HOME/pkg/__init__.py # empty >>> cat $HOME/pkg/subpkg/__init__.py import a import b >>> cat $HOME/pkg/subpkg/a.py class A: pass >>> cat $HOME