Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

pathlib.Path().exists doesn't work correctly #80

Open
wolfv opened this issue Oct 25, 2022 · 0 comments
Open

pathlib.Path().exists doesn't work correctly #80

wolfv opened this issue Oct 25, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@wolfv
Copy link

wolfv commented Oct 25, 2022

For some reason, this fails with an error in xeus-python but works in pyodide/pyolite:

import os
import pathlib
os.path.exists("/drive/idontexist")
pathlib.Path("/drive/idontexist").exists()

In xeus-python it prints:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
/tmp/xpython_42/3913635030.py in <cell line: 4>()
      2 import pathlib
      3 os.path.exists("/drive/idontexist")
----> 4 pathlib.Path("/drive/idontexist").exists()

/tmp/xeus-python-kernel/envs/xeus-python-kernel/lib/python3.10/pathlib.py in exists(self)
   1286         """
   1287         try:
-> 1288             self.stat()
   1289         except OSError as e:
   1290             if not _ignore_error(e):

/tmp/xeus-python-kernel/envs/xeus-python-kernel/lib/python3.10/pathlib.py in stat(self, follow_symlinks)
   1093         os.stat() does.
   1094         """
-> 1095         return self._accessor.stat(self, follow_symlinks=follow_symlinks)
   1096 
   1097     def owner(self):

OSError: [Errno 28] Invalid argument: '/drive/idontexist'
@wolfv wolfv added the bug Something isn't working label Oct 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant