xeus-python-kernel icon indicating copy to clipboard operation
xeus-python-kernel copied to clipboard

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

Open wolfv opened this issue 3 years ago • 0 comments

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 avatar Oct 25 '22 14:10 wolfv