question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
RemiDesgrangecommented, Apr 27, 2022

Working thanks 👍

1reaction
snowman2commented, Apr 27, 2022

How about this?

python -m pip install cython==3.0.0a10
python -m pip install --no-use-pep517 --no-binary ':all:' pyproj
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found