[Tutor] Open file error

andy senoaji andy.senoaji at gmail.com
Tue Jan 17 18:11:38 CET 2006


I am starting to pull my hair here. There were some postings in the past,
similar to my problem, but the response was not clear enough. Sorry if you
thingk I am reposting this.

I am trying to run (on an XP box) a simple open file using this:
f = open(r'C:\Test.txt', 'r')

but it keeps give me nagging error of:
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in -toplevel-
    f = open('Test.txt', 'r')
IOError: [Errno 2] No such file or directory: 'C:\Test.txt'

I know for sure that the file is there, I even put copies of the files here
and there, just to guess how python does the file search, but it
keeps giving me 'No such file or directory'. i also tried variation of the
file location string, but gave me a variation of errors :). Any suggestions?

Furthermore, how does Python assumes the search path? Will it look at /LIB
first? How does it knows drive lettering, network mapping etc? Is there a
configuration settings that I can tweak in my Python? FYI I am using
Activestate's.


Thx,

Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060117/9ebe0f2d/attachment.html 


More information about the Tutor mailing list