On 12/19/2011 08:33 PM, Stayvoid wrote:
Please clarify, or expand, or tell us what problem you are having or
trying to solve.
Hi!
I want to have a possibility to import modules from the folder, which
is not included in the load path.
Example:
module.py
---------
def testfunc(name):
file = open(name)
return len(file.readlines())
if __name__ == "__main__":
print testfunc(module.py)
Code listing (shell):
python /Users/Username/pythonmodules/module.py
NameError: name 'module.py' is not defined
Kind regards.
First rule: include the complete error message, including the traceback.
Also, make sure you copy/paste the message, not paraphrase or retype it.
Anyway, chances are the error occurs because you didn't have any quotes
around the filename. Python is forced to look up the name "module" in
the global dictionary, and it can't find it. Of course, the error
message wouldn't be exactly that.
--
DaveA
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor