[Tutor] Need help in python

alan.gauld@bt.com alan.gauld@bt.com
Mon, 16 Oct 2000 11:14:43 +0100


> i m a new student at a college and need some help using python....
> this is regarding the "open" command......
> 
> here is a section of my code...
> # open file and read
> 
>     input_file=open("p7.dat","r")

> nothing seems wrong rite? well when i try to run this module 
> from within python it gives me an IO error saying
> IOError: [Errno 2] No such file or directory: 'p7.dat'

I assume that 'from within python' means from IDLE?
If so I think IDLE will look for the file in its own directory.
Try providing the full path to the file.

> but then when i run the program in DOS

Were you sitting in the same directory as the file by any chance?

Alan G.