On 25/12/11 22:55, Stayvoid wrote:

There is a module called lcclient_lutz.py:

from lengthcounter_lutz import countLines, countChars
print countLines('lengthcounter_lutz.py'), countChars('lengthcounter_lutz.py')

countChars('lengthcounter_lutz.py')
   File "/Users/Username/Python_modules/lengthcounter_lutz.py", line 2,
in countLines
     file = open(name)
IOError: [Errno 2] No such file or directory: 'lengthcounter_lutz.py'

How to fix it? Is it connected with the PYTHONPATH variable?

PYTHONPATH only helps Python find the files to import.
Since the error message is pointing at code insiude the imported functions then clearly PYTHONPATH is working just fine.


So what is the error?
Simply that python is saying it cannot find the file.
So it is probably in a different folder to the one in which the program is running. You need to provide a valid path to the file,

P.S. There might be an error in the lengthcounter_lutz module, because
it makes mistakes while counting.

Thats possible. Or it may e worlking to a different definition of success to the one you expect! Counting words and letters is quite a subjective past-time.

So what is it doing exactly that seems wrong?
What input? What output? What did you expect?


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to