os/stat broken under 2.2 / Linux ?

Pasiphe's Bull sorry at this.is.my.work.account.com
Tue Nov 12 17:59:57 EST 2002


Python 2.2 (#1, Apr 12 2002, 15:29:57) 
[GCC 2.96 20000731 (Red Hat Linux 7.2 2.96-109)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import stat
>>> import os   
>>> file_mode = os.stat("./foo")
>>> if (stat.S_ISDIR(file_mode)):
...     print "is dir"
... else:
...     print "is NOT dir"
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.2/stat.py", line 46, in S_ISDIR
    return S_IFMT(mode) == S_IFDIR
  File "/usr/lib/python2.2/stat.py", line 30, in S_IFMT
    return mode & 0170000
TypeError: unsupported operand type(s) for &: 'posix.stat_result' and 'int'
>>>



More information about the Python-list mailing list