En Tue, 25 Mar 2008 15:35:34 -0300, Bjoern Schliessmann <[EMAIL PROTECTED]> escribió:
> ptn wrote: >> Traceback (most recent call last): >> File "path.py", line 4, in <module> >> f = open('~/read/foo.txt') >> IOError: [Errno 2] No such file or >> directory: '~/read/foo.txt' >> [...] >> So, what's wrong here? Maybe there's something I haven't set up? > > Simple: the directory "~" doesn't exist. Since you're not using a > shell (but direct file access) there is no tilde expansion, and "~" > is treated as a regular file name. If you need to get the home > directory refer to the environment variable HOME > (os.environ["HOME"]). There even may be a shorter way, please refer > to the os module docs. That shorter way being os.path.expanduser http://docs.python.org/lib/module-os.path.html -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list