why _import__ only works from interactive interpreter?

BartlebyScrivener rpdooling at gmail.com
Sun May 7 19:14:46 EDT 2006


I'm on Windows, but I think you need the shebang thing at the top of
your script, right?

Then, put whatever you want to import in a script or module called
testmod.py.

Then you should be able to import either into a script or at the
command line using simply:

import testmod

If it doesn't work then you need to make sure the script is in your
PythonPath.

It looks like you are using the built-in function version of import.

http://docs.python.org/dev/lib/built-in-funcs.html

Is there a reason? Otherwise, do it the easy way:

rick




More information about the Python-list mailing list