[Tutor] Acessing files in Windows 2000

jfouhy at paradise.net.nz jfouhy at paradise.net.nz
Wed Mar 9 22:18:47 CET 2005


> > >>>
> > >>>
> > >>> import os.path
> > >>> print os.path.expanduser('~/memo.txt')
> > C:\Documents and Settings\Administrator/memo.txt
> > >>> f = open(os.path.expanduser('~/memo.txt'))
> > Traceback (most recent call last):
> > File "<pyshell#15>", line 1, in ?
> > f = open(os.path.expanduser('~/memo.txt'))
> > IOError: [Errno 2] No such file or directory: 'C:\\Documents and
> > Settings\\Administrator/memo.txt'
> > >>>
> > 
> > Now starting to doubt my sanity I again re-checked C:\Documents and
> > Settings\Administrator\My Documents
> > and yes I do have a memo.txt there.

Um ---

So you have a file 'C:\Documents and Settings\Administrator\My
Documents\memo.txt'...

But you are attempting to open the file 'C:\Documents and
Settings\Administrator\memo.txt'.

There is a difference there!

-- 
John.


More information about the Tutor mailing list