`path.sep` goes missing when importing in a debugger in Python 3.10
See original GitHub issueI’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.
import os
import pyproj
os.path.sep
if __name__ == '__main__':
pass
More details are available in the repository README.
Problem description
When importing pyproj
in a debugger the os.path
module gets modified so that os.path.sep
raises an AttributeError
Expected Output
os.path.sep
returns the same value as before importing os.path.sep
Environment Information
Run inside a docker container defined as follows:
FROM python:3.10.2-bullseye@sha256:083f7050ed966b5e430b5c0ebc439af58094ac59f37861573966121652d2d790 AS base
WORKDIR /app
RUN pip install --upgrade pip==21.3.1
RUN curl -sSL https://install.python-poetry.org | python - --yes --version 1.1.12
ENV PATH="/root/.local/bin:$PATH"
RUN poetry config virtualenvs.create false
COPY pyproject.toml .
RUN poetry lock
RUN poetry install --no-interaction
Dependencies are defined via Poetry in a pyproject.toml
file:
[tool.poetry]
name = "Debug missing sep"
version = "0.1.0"
description = "Routing"
authors = ["Tom Finill"]
[tool.poetry.dependencies]
python = "==3.10.2"
pyproj = "==3.3.0"
Installation method
Poetry (see Dockerfile
above)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top Results From Across the Web
path.sep goes missing when importing in a debugger ... - GitHub
This bug means that we can't use pytest with stable Fiona on Python 3.10.
Read more >What's New In Python 3.10 — Python 3.11.1 documentation
PEP 626, Precise line numbers for debugging and other tools. ... but in Python 3.10 a more informative error is emitted: ... Missing...
Read more >in VS Code ImportError: cannot import name 'Mapping' from ...
4. I think the problem is inside the test.py: from collections import Mapping · 7. Problem solved by: from collections. · 2. It...
Read more >How to use the Python debugger (pdb) - Red Hat
Pdb is a powerful tool for finding syntax errors, spelling mistakes, missing code, and other issues in your Python code.
Read more >Python debugger not working while normal run does
The python debugger in Pycharm (I've the latest version) is not working for ... This way import termios in getpass will correctly fail...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Working thanks 👍
How about this?