[python-win32] fake imports ?

Tony Cappellini tony at tcapp.com
Sun Feb 1 02:20:33 EST 2004



I've written some python functions that I use whenever I'm in the 
interactive interpreter, so I want them automatically imported an available 
whenever I run interactively..
These are imported by site.py

try:
     import sitecustomize
except ImportError:
     pass


sitecustomize.py contains only this (for now)

try:
     import mymods
except ImportError:
     pass


After PythonWin is launched- I wanted to verify that mymods actually got loaded

so I type mymods.

and the popup list shows the functions I've defined in mymods.py
(this implies the import was successfull)

However, when I try calling one of these functions as in

mymods.somefunc()

NameError: mymods is not defined

So I tried the same thing with the os module
(mymods.py imports the os module)

os.

the popup list shows attributes of the os module that are available

however, when I try to invoke os.getcwd()

NameError: os is not defined


I don't understand why the popuplist with the module attributes is 
displayed, if the name hasn't been imported into PythonWin's namespace


Would someone explain this ?

thanks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20040131/b48ca2eb/attachment.html


More information about the Python-win32 mailing list