[Tutor] i have a major problem

Sheila King sheila@thinkspot.net
Sun, 09 Sep 2001 10:44:15 -0700


On Sun, 9 Sep 2001 10:17:05 -0500, "Nick Wertzberger" <nwertz@home.com>
wrote about [Tutor] i have a major problem:

:every time i try to access a file named snakeoil.txt, i get htis message:
:Traceback (most recent call last):
:  File "<pyshell#2>", line 1, in ?
:    data=open("snakeoil.txt")
:IOError: [Errno 2] No such file or directory: 'snakeoil.txt'
:
:how do i fix this PROBLEM!?!?!?!?

I've recently been having problems of this type, myself.
If python says the file doesn't exist, then you must be doing something
wrong, like being in the wrong directory, spelling or case error or
something.

One thing that I have found to help, is adding a few lines to my script,
something like this:

>>> import os
>>> os.listdir(os.curdir)

This will return a list of all the files in the current directory.
Sometimes looking at the list of files that Python sees in the current
directory can be quite insightful.

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/