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

Martin Miller mmiller@adobe.com
Thu, 17 Jan 2002 13:02:31 -0800


On 17/01/02 10:28:07, Francois Granger wrote:
> 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')
> >>> 


Well, as I indicated, it is not in the mac module I have:

Python 2.2 (#124, Dec 22 2001, 17:36:41)  [CW CARBON GUSI2 THREADS GC]
Type "copyright", "credits" or "license" for more information.
MacPython IDE 1.0.1
>>> import mac
>>> dir(mac)
['F_OK', 'O_APPEND', 'O_CREAT', 'O_EXCL', 'O_NOCTTY', 'O_NONBLOCK',
'O_RDONLY', 'O_RDWR', 'O_TRUNC', 'O_WRONLY', 'R_OK', 'TMP_MAX', 'W_OK',
'X_OK', '__doc__', '__name__', 'chdir', 'close', 'dup', 'error',
'fdopen', 'fstat', 'getcwd', 'listdir', 'lseek', 'mkdir', 'open',
'read', 'remove', 'rename', 'rmdir', 'stat', 'stat_result', 'sync',
'unlink', 'write']
>>>