Issue1289

classification
Title: os.path.isdir(path) return 0 istead of False
Type: behaviour Severity: urgent
Components: Library Versions: 2.5b1
Milestone:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: carlo.amicucci, pjenvey
Priority: Keywords:

Created on 2009-03-26.15:17:04 by carlo.amicucci, last changed 2009-03-30.16:29:17 by pjenvey.

Messages
msg4354 (view) Author: Carlo Amicucci (carlo.amicucci) Date: 2009-03-26.15:17:03
Hello, 
the os.path.isdir(path)function that should return a False (bool) if
'path' is not a directory return a 0 (type int). If path is a directory
the function work correctly and return a True (bool).

Bt,
Carlo
msg4355 (view) Author: Carlo Amicucci (carlo.amicucci) Date: 2009-03-26.15:38:39
Another different behavior between python and jython is the following.
In Python if I have a path like 'c:/temp'

Both os.path.isdir('c:/temp') and os.path.isdir('c:/temp/') return True
(bool). In jython only os.path.isdir('c:/temp') return True. Instead
os.path.isdir('c:/temp/') return 0 (int) like a False.

Thanks,
Carlo
msg4357 (view) Author: Philip Jenvey (pjenvey) Date: 2009-03-26.21:31:06
Can't reproduce this on the latest trunk. What module is os.path on your 
platform? Under what O/S?
msg4358 (view) Author: Carlo Amicucci (carlo.amicucci) Date: 2009-03-27.10:44:06
Hello Philip,

I am using jython on:
o	Window XP SP2
o	Java JRE 1.5
o	Jython version Jython 2.5b3

Version information from PyDev console is the following: 

java1.5.0_15 2.5b3 (Release_2_5beta3:6092, Mar 10 2009, 15:34:57) 
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)]

Thanks,
Carlo
msg4380 (view) Author: Philip Jenvey (pjenvey) Date: 2009-03-29.21:44:42
Your path module should be ntpath, but I can't see how ntpath.isdir 
would return 0 in any case. It returns the result of stat.ST_ISDIR which 
is a bool

What's returned from the interpreter when you simply execute the 
following expression?

Jython 2.5b3+ (trunk:6112:6113M, Mar 29 2009, 15:03:34) 
[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_07
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path
msg4385 (view) Author: Carlo Amicucci (carlo.amicucci) Date: 2009-03-30.16:17:55
Yes, I am using ntpath...
<module 'ntpath' from 'C:\jython2.5b3\Lib\ntpath$py.class'>

I just tried to use jython outside the Eclipse pydev console. In this
case, using the same JVM (java 1.5.0_15) but from the command prompt the
os.path.isdir has the right behavior and return False. So the strange
behavior is in the pydev plugin for Eclipse.

Thanks,
Carlo
msg4386 (view) Author: Philip Jenvey (pjenvey) Date: 2009-03-30.16:29:16
Ok, you'll have to take it up with pydev then. They must be overriding one 
of the involved module/functions, for some reason. Closing out
History
Date User Action Args
2009-03-30 16:29:17pjenveysetstatus: open -> closed
resolution: works for me
messages: + msg4386
2009-03-30 16:17:56carlo.amicuccisetmessages: + msg4385
2009-03-29 21:44:43pjenveysetmessages: + msg4380
2009-03-27 10:44:08carlo.amicuccisetmessages: + msg4358
2009-03-26 21:31:07pjenveysetnosy: + pjenvey
messages: + msg4357
2009-03-26 15:38:39carlo.amicuccisetmessages: + msg4355
2009-03-26 15:17:04carlo.amicuccicreate