okay, thanks everyone. this is much clearer now.
--
http://mail.python.org/mailman/listinfo/python-list
TG wrote:
> okay,
>
> so only when I have inside __init__.py
>
> __all__ = ["core"]
>
> this works
>
> ?> from tom import *
> ?> help(core)
>
> but (in a brand new interpretor)
>
> ?> import tom
> ?> help(tom.core)
>
> AttributeError: 'module' object has no attribute 'core'
>
> got it. But
okay,
so only when I have inside __init__.py
__all__ = ["core"]
this works
?> from tom import *
?> help(core)
but (in a brand new interpretor)
?> import tom
?> help(tom.core)
AttributeError: 'module' object has no attribute 'core'
got it. But ...
?> import numpy
?> help(numpy.core)
this w
TG wrote:
> if I import tom, it is supposed to load functions defined in
> tom/__init__.py and make all the modules inside accessible through the
> "dot" syntax.
>
> Therefore, this is supposed to work :
>
> ?> import tom
> ?> help(tom.core)
>
> AttributeError: 'module' object has no attribute
BartlebyScrivener wrote:
> then you no longer need tom, you imported all of his FUNCTIONS (never
> heard of submodule).
my mistake, I was using the wrong name
tom/ <-- package
__init__.py
core.py <
data.py < these are modules contained in tom/
ui.py <
if I import t
http://tinyurl.com/6yz2g
If you do
from tom import *
then you no longer need tom, you imported all of his FUNCTIONS (never
heard of submodule).
rd
--
http://mail.python.org/mailman/listinfo/python-list
I know this is a bad habit ... I was just doing it to show what is
disturbing me.
Obviously the "star" syntax finds the submodules because they are
loaded, but when I properly load the module alone with "import tom",
the "dot" syntax does not find "tom.core".
BartlebyScrivener wrote:
> >> > from
>> > from tom import *
You CAN do this, but it's a bad habit.
Try:
>>import tom
Then call by tom.function()
rd
--
http://mail.python.org/mailman/listinfo/python-list
I've just found this :
If I add :
"import core, data, ui" inside my "tom/__init__.py" file, it will
work. But this line does not seems to exist in other files (after
having a look at several files inside /usr/lib/python2.4).
--
http://mail.python.org/mailman/listinfo/python-list
hi.
This is my first try on modules.
I've got :
tom/
__init__.py
core.py
ui.py
data.py
then, when I'm in my ipython shell :
?> from tom import *
this works, it loads core, ui and data
but when I do this :
?> import tom
?> tom.core
AttributeError: 'module' object has no att
10 matches
Mail list logo