Message6104

Author crankycoder
Recipients crankycoder, fwierzbicki, zyasoft
Date 2010-09-28.16:00:48
SpamBayes Score 9.064971e-14
Marked as misclassified No
Message-id <1285689661.02.0.443642298229.issue1414@psf.upfronthosting.co.za>
In-reply-to
Content
This is a bug related to os.stat.  It might be related to msvcrt.dll's problems with the stat function.  I have no idea how it works on CPython, but it does work correctly.

A work around would be to implement os.path.exists using java.io.File instead.  This always seems to work.

Can we patch os.path.exists to just use java.io.File instead of trying to use stat()?

Here's the output using Jython 2.5.2beta2 and cpython 2.6 

----

> jython
Jython 2.5.2b2 (Release_2_5_2beta2:7124, Sep 14 2010, 00:11:45)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_20
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> path = '\\\\cbmcc-fn-00020c\\1202\RTMO'
>>> os.path.exists(path)
False
>>> os.stat(path)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 2] No such file or directory: '\\\\cbmcc-fn-00020c\\1202\\RTMO'
>>> import posix
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named posix
>>> from java.io import File
>>> File(path).exists()
True
>>> File(path).isDirectory()
True
>>>

[WMBCEXTRMW308GV]
Tue 09/28/2010 11:58:14.79
[D:\dev\sandbox\waffle]
> python
'python' is not recognized as an internal or external command,
operable program or batch file.

[WMBCEXTRMW308GV]
Tue 09/28/2010 11:58:16.82
[D:\dev\sandbox\waffle]
> c:\Python26\python.exe
Enthought Python Distribution -- http://www.enthought.com
Version: 6.1-1 (32-bit)

Python 2.6.4 |EPD 6.1-1 (32-bit)| (r264:75706, Nov 11 2009, 19:42:36) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> path = '\\\\cbmcc-fn-00020c\\1202\RTMO'
>>> os.path.exists(path)
True
>>> os.stat(path)
nt.stat_result(st_mode=16895, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=0L, st_atime=1285689458L, st_
mtime=1285687451L, st_ctime=1214228226L)
>>>
History
Date User Action Args
2010-09-28 16:01:01crankycodersetmessageid: <1285689661.02.0.443642298229.issue1414@psf.upfronthosting.co.za>
2010-09-28 16:01:01crankycodersetrecipients: + crankycoder, fwierzbicki, zyasoft
2010-09-28 16:01:00crankycoderlinkissue1414 messages
2010-09-28 16:00:48crankycodercreate