Dave,

>  >>>
>  >>>
>  >>> 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.
> 

Using all forward slashes works fine for me. Here's a cut-n-paste from
the command line (touch creates a blank file, ls lists dirs, in case
you didn't know):

C:\Documents and Settings\WMill>touch test.txt

C:\Documents and Settings\WMill>ls test.txt
test.txt

C:\Documents and Settings\WMill>C:\Python24\python.exe
Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> f = open('c:/Documents and Settings/WMill/test.txt')
>>>

I'm really pretty convinced that the file you're talking about doesn't
exist, or you don't have the security permissions to open it.

Peace
Bill Mill
bill.mill at gmail.com
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to