[Tutor] Open file error

Alan Gauld alan.gauld at freenet.co.uk
Wed Jan 18 06:24:00 CET 2006

>>> f=open(r'c:\Test.txt','r')
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
IOError: [Errno 2] No such file or directory: 'c:\\Test.txt'

Its pretty determined that Test.txt doesn't exist.
What happens if you do:

import os

In other words does Python see the file at all?
And have you checked that you have access to the file in Windows Explorer?

Alan G.

More information about the Tutor mailing list