[Pythonmac-SIG] Newbie Question: xstat() function?

Francois Granger fgranger@altern.org
Thu, 17 Jan 2002 10:28:07 +0100


on 17/01/02 4:12, Martin Miller at mmiller@adobe.com wrote:

> I have a dumb newbie question. The documentation at
> <http://www.python.org/doc/current/mac/module-mac.html> for the
> MacPython mac module says:
> 
> ==snip==
>> One additional function is available:
>> 
>> xstat(path) 
>>        This function returns the same information as stat(), but with three
>> additional values appended: the size of the resource fork of the file and its
>>        4-character creator and type.
> ==snip==
> 
> However the xstat() function does not appear to be available in either
> the "mac" or "os" module that is distributed with MacPython 2.2. I would
> like to access the 4-byte creator and type of a Macintosh file. Is it
> missing by mistake or am I doing something wrong? I have tried both
> mac.xstat(path) and os.xstat(path). I also tried the standard os.stat(),
> but it does not return any extra values as described.

It is in the mac module:

>>> import mac
>>> dir(mac)
['__doc__', '__name__', 'chdir', 'close', 'dup', 'error', 'fdopen', 'fstat',
'getbootvol', 'getcwd', 'listdir', 'lseek', 'mkdir', 'open', 'read',
'remove', 'rename', 'rmdir', 'stat', 'sync', 'unlink', 'write', 'xstat']
>>> mac.xstat('README')
(33206, 310280, -1, 1, 0, 0, 9209, 3079632124.0, 3079632124.0, 3078256323.0,
428, 'CWIE', 'TEXT')
>>>