[PYTHONMAC-SIG] Mac open()

Guido van Rossum guido@CNRI.Reston.Va.US
Wed, 19 Jun 1996 23:13:51 -0400


> This is really bugging me.
> On my mac, I can't seem to use the open() function for
> files in subfolders. I'm using the right separator etc.
> But it insists on failing to find the file.  I'm using
> the 1.3 PowerPC version.  Any idea's?  This may relate
> to the faulty rename builtin function.
> 
> >>> s = open('data:DoI.txt')
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
> IOError: (-43, 'File not found')
> >>> os.listdir('data')
> ['DoI.txt', 'parrot']
> >>> f = open('data:a','w')
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
> IOError: (-43, 'File not found')

I bet it's the Mac pathname syntax.  If a pathname contains a colon,
it's *relative* when it starts with a colon, it's *absolute* when
it doesn't (when it contains no colon at all, it's always relative).

A pathname of the form HD:dir:subdir:file is an absolute pathname,
on volume "HD", folder "dir", subfilder "subdir", file "file".

A pathname of the form ":subdir:file" is a relative pathname,
in the current directory, subdirectory "subdir", file "file".

--Guido van Rossum

=================
PYTHONMAC-SIG  - SIG on Python for the Apple Macintosh

send messages to: pythonmac-sig@python.org
administrivia to: pythonmac-sig-request@python.org
=================