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
#1028
Comments
I am wondering if this problem should be addressed by the debugger you mentioned and not in pyproj itself? |
That's definitely a possibility. Although I'm thinking that the issue may be with Cython not playing nice with the new debug changes in Python 3.10. I guess if you can't see anything that's obviously wrong I'll try opening an issue elsewhere. |
That makes sense. If you wouldn't mind opening up an issue with Cython, that would be helpful to further pin down the issue. |
I also stumbled upon this issue, while trying to debug a codebase that relies on pyproj. It doesn't work and trying to patch around the exception wasn't successful either. I'm not seeing any issues over at cython/cython that address this issue. @scoder are you aware of this? Over at /edit: for my concrete use case, this is the traceback that is produced when trying to debug any pytest test that imports from itur/pyproj/certifi: ImportError while loading conftest '[./test/conftest.py]()'.
test[/conftest.py:3](): in <module>
src[/some_module.py:8](): in <module>
import itur
.[./../.pyenv/versions/3.10.2/lib/python3.10/site-packages/itur/__init__.py:29](): in <module>
import itur.utils
.[./../.pyenv/versions/3.10.2/lib/python3.10/site-packages/itur/utils.py:18](): in <module>
from pyproj import Geod
.[./../.pyenv/versions/3.10.2/lib/python3.10/site-packages/pyproj/__init__.py:93](): in <module>
pyproj.network.set_ca_bundle_path()
.[./../.pyenv/versions/3.10.2/lib/python3.10/site-packages/pyproj/network.py:51](): in set_ca_bundle_path
ca_bundle_path = certifi.where()
.[./../.pyenv/versions/3.10.2/lib/python3.10/site-packages/certifi/core.py:36](): in where
_CACERT_CTX = get_path("certifi", "cacert.pem")
E AttributeError: module 'posixpath' has no attribute 'sep' |
Might be this: cython/cython#4735 |
If I read the issue correctly and the release on pypi, we need to use cython from source from the branch 0.29, or cython 3. I tried installing this way:
Maybe I'm missing something. I also tried it in a docker container and a brand new venv. |
How about this?
|
Working thanks 👍 |
Cython 0.29.29 has been released: https://github.com/cython/cython/releases/tag/0.29.29. This should be resolved in the wheels build with the next release of pyproj. In the meantime, this should work:
|
I've created a repository that contains a working example that demonstrates this problem.
Code Sample, a copy-pastable example if possible
The problem arises when importing
pyproj
in a debugger. A minimal example is as follows.More details are available in the repository README.
Problem description
When importing
pyproj
in a debugger theos.path
module gets modified so thatos.path.sep
raises anAttributeError
Expected Output
os.path.sep
returns the same value as before importingos.path.sep
Environment Information
Run inside a docker container defined as follows:
Dependencies are defined via Poetry in a
pyproject.toml
file:Installation method
Poetry (see
Dockerfile
above)The text was updated successfully, but these errors were encountered: