Module Is Not Callable
Gerrit Holl
gerrit at nl.linux.org
Sat Jan 11 10:33:41 EST 2003
beno schreef op zaterdag 11 januari om 16:06:35 +0000:
> Subject: Module Is Not Callable
> Hi;
> I have tested the following script and it works as long as I input it into
> the command prompt. But when I try and write it to a script, then call the
> script, I get the following error:
>
> >>> import test
> >>> import string
> >>> test()
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: 'module' object is not callable
>
> Why?
> TIA,
A module is not supposed to be callable. A module is executed when it is
imported. Use execfile to execute a file without importing the module.
More information on modules:
http://www.python.org/dev/doc/devel/tut/node8.html (read this first)
http://www.python.org/dev/doc/devel/ref/import.html#l2h-358
yours,
Gerrit.
--
Asperger Syndroom - een persoonlijke benadering:
http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
http://www.sp.nl/
More information about the Python-list
mailing list