[Tutor] problem in opening files
promis at yorku.ca
promis at yorku.ca
Sun Jun 24 20:17:56 CEST 2012
I'm am just new to Python, and am having trouble getting started. I
am trying to open files of data that I want to work on, and keep on
getting a message that no such file exist. For example here is a
copy of what I've typed and the error message
>>> fo = open('mort.txt') THIS IS WHAT I TYPED AND THE MESSAGE FOLLOWS
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
fo = open('mort.txt')
IOError: [Errno 2] No such file or directory: 'mort.txt'
>>>
The file mort.txt certainly seems to me to exist. I can see it on my
desktop. It was a small sample file that I just created to test this
out. At first I was just using 'mort', which is what appears on my
desktop, but it was suggested to me that I should include the
extension .txt, which I have verified is the correct extension, so
that's not the problem anymore. I have in fact tried this with a
number of files and I get the same message every time. I am using
Python versus 3.2.2. , on a MAC with system OS 10.6.8 .
Any help would be appreciated
David
More information about the Tutor
mailing list