Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve raises a WindowsError in py2.7 when a path does not exist. #54

Closed
danbradham opened this issue Apr 17, 2019 · 2 comments
Closed

Comments

@danbradham
Copy link

the resolve method is not behaving as expected in python2.7 when called with a path that does not exist.

Expected behavior

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pathlib import Path
>>> Path('~/does_not_exist').resolve()
WindowsPath('~/does_not_exist')
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pathlib2 import Path
>>> Path('~/does_not_exist').resolve()
WindowsPath('~/does_not_exist')

Actual behavior

Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pathlib2 import Path
>>> Path('~/does_not_exist').resolve()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Projects\python\construct_org\construct\venv27\lib\site-packages\pathlib2\__init__.py", line 1343, in resolve
    self.stat()
  File "C:\Projects\python\construct_org\construct\venv27\lib\site-packages\pathlib2\__init__.py", line 1356, in stat
    return self._accessor.stat(self)
  File "C:\Projects\python\construct_org\construct\venv27\lib\site-packages\pathlib2\__init__.py", line 541, in wrapped
    return strfunc(str(pathobj), *args)
WindowsError: [Error 3] The system cannot find the path specified: '~\\does_not_exist'
mcmtroffaes added a commit that referenced this issue May 3, 2019
@mcmtroffaes
Copy link
Collaborator

Thanks for reporting. I'm trying to fix this in the feature/fix-resolve branch (see pull request #55) but I don't have a windows system. Could you give the branch a go and see if it indeed fixes the problem for you?

mcmtroffaes added a commit that referenced this issue May 14, 2019
…h in Python 2.7, to match behaviour on Python 3.x.

Closes issue #54.
@mcmtroffaes
Copy link
Collaborator

This should now be fixed in develop, and so the fix will be included in the next release.

Thanks again for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants