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

path.sep goes missing when importing in a debugger in Python 3.10 #1143

Closed
idanmiara opened this issue Oct 2, 2022 · 5 comments
Closed

path.sep goes missing when importing in a debugger in Python 3.10 #1143

idanmiara opened this issue Oct 2, 2022 · 5 comments
Assignees

Comments

@idanmiara
Copy link

idanmiara commented Oct 2, 2022

Hi,

I think I'm encountering the same error as pyproj4/pyproj#1028 but with Fiona instead of pyproj

Also related:
pytest-dev/pytest#9791 (comment)

Expected behavior and actual behavior.

The following code should run without any error:

import os
print(os.path.sep)
import fiona
print(os.path.sep)

But, I get the following exception:

/Users/idan.miara/.pyenv/versions/py310/bin/python /Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client 127.0.0.1 --port 49298 --file /Users/idan.miara/workspace/temp/temp.py 
/
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1496, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/idan.miara/workspace/temp/temp.py", line 4, in <module>
    print(os.path.sep)
AttributeError: module 'posixpath' has no attribute 'sep'```

Steps to reproduce the problem.

Run the code snippet above in Python 3.10 in debug mode (I use PyCharm)

The problem is reproducible on:
Python 3.10.7 in debug mode

The problem is not reproducible on:
Python 3.10.7 in non-debug mode (normal run)
Python 3.9.12 in either mode

Operating system

For example: Mac OS X 12.6

Fiona and GDAL version and provenance

Fiona 1.8.21 installed from PyPI using pip version 22.2.2.

@sgillies sgillies self-assigned this Oct 2, 2022
@sgillies
Copy link
Member

sgillies commented Oct 2, 2022

@idanmiara thanks for the report! I expect this could affect rasterio in some ways, too.

Fiona 1.9.x no longer pins cython in pyproject.toml, so the sdist is fine. The wheels were probably built with a buggy version of cython. Fiona 1.8.x wheels and sdists will be affected.

@idanmiara
Copy link
Author

Hi @sgillies
Thanks for looking into this!

I'm understanding that Fiona 1.9 is atill Alpha, and this bug won't be fixed for 1.8 because it pins the buggy Cython version?
If so - didn't Cython release a stable bugfix release that can be applied to Fiona 1.8?

This bug means that we can't use pytest with stable Fiona on Python 3.10.

@sgillies
Copy link
Member

sgillies commented Oct 3, 2022

@idanmiara I think a 1.8.22 release is appropriate. It's only the use of Python's development mode that is prevented, no? Or is a future version of pytest switching to requiring development mode?

@idanmiara
Copy link
Author

idanmiara commented Oct 3, 2022 via email

@sgillies
Copy link
Member

Done!

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

No branches or pull requests

2 participants