Issue1948

classification
Title: os.path.exists('') == True
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7
process
Status: open Resolution: accepted
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: duffy151, fwierzbicki, hjacobs, santa4nt, zyasoft
Priority: normal Keywords:

Created on 2012-07-23.21:27:21 by duffy151, last changed 2014-07-26.10:53:22 by hjacobs.

Messages
msg7333 (view) Author: Kevin Duffy (duffy151) Date: 2012-07-23.21:28:44
Here is the jython output:
===>
>java -jar ./code/jython2.7a2/jython.jar 
Jython 2.7a2 (default:9c148a201233, May 24 2012, 15:49:00) 
[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_33
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, os.path
>>> sys.version
'2.7a2 (default:9c148a201233, May 24 2012, 15:49:00) \n[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)]'
>>> os.path.exists('')
True
>>> 

<===

Versus the CPython output:
>python
Python 2.7.3 (default, Jul  9 2012, 10:36:52) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, os.path
>>> sys.version
'2.7.3 (default, Jul  9 2012, 10:36:52) \n[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]'
>>> os.path.exists('')
False
>>>
msg8728 (view) Author: Jim Baker (zyasoft) Date: 2014-06-19.06:28:44
Target beta 4
msg8891 (view) Author: Henning Jacobs (hjacobs) Date: 2014-07-26.09:51:19
FYI: the Java API also returns True for "exists":

Jython 2.7b3+ (default:f60284af81dc+, Jul 26 2014, 10:35:36) 
[OpenJDK 64-Bit Server VM (Oracle Corporation)] on java1.7.0_55
Type "help", "copyright", "credits" or "license" for more information.
>>> from java.nio.file import *
>>> p = Paths.get('')
>>> Files.exists(p)
True
>>>
msg8892 (view) Author: Henning Jacobs (hjacobs) Date: 2014-07-26.10:29:41
os.stat in Jython returns the stat structure for the current directory -- I will change the os.stat in Jython to raise an exception as cpython does
msg8893 (view) Author: Henning Jacobs (hjacobs) Date: 2014-07-26.10:53:22
Create pull request with fix: https://github.com/jythontools/jython/pull/4
History
Date User Action Args
2014-07-26 10:53:22hjacobssetmessages: + msg8893
2014-07-26 10:29:41hjacobssetmessages: + msg8892
2014-07-26 09:51:19hjacobssetnosy: + hjacobs
messages: + msg8891
2014-06-19 16:02:50santa4ntsetnosy: + santa4nt
components: + Library, - None
2014-06-19 06:28:44zyasoftsetresolution: remind -> accepted
messages: + msg8728
nosy: + zyasoft
2013-02-20 00:14:17fwierzbickisetpriority: normal
assignee: fwierzbicki
resolution: remind
nosy: + fwierzbicki
versions: + Jython 2.7, - 2.7a2
2012-07-23 21:28:45duffy151setmessages: + msg7333
2012-07-23 21:27:21duffy151create