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

local module imports fail after os.chdir #557

Closed
inducer opened this issue Sep 20, 2022 Discussed in #556 · 2 comments
Closed

local module imports fail after os.chdir #557

inducer opened this issue Sep 20, 2022 Discussed in #556 · 2 comments
Labels

Comments

@inducer
Copy link
Owner

inducer commented Sep 20, 2022

Discussed in #556

Originally posted by raphCode September 20, 2022
Describe the bug

After os.chdir() local modules cannot be imported when run under pudb and raise ModuleNotFoundError.

To Reproduce

  • create files:
    • some_module.py (empty)
    • some_folder/ (empty directory)
    • test.py content as follows:
import os

os.chdir("some_folder")
import some_module
  • run pudb3 test.py
  • import of some_module fails

Expected behavior

Module is imported successfully, no ModuleNotFoundError is raised.

Additional context

When run under the normal python interpreter this works.
The reason seems to be that sys.path is normally populated with an absolute path to the directory from which python is run.
When run under pudb, it is only populated with the empty string which does refer to the current directory, which is wrong after the os.chdir().

Versions

Python 3.10.7
pudb:pudb3 v2022.1.2

@inducer
Copy link
Owner Author

inducer commented Sep 20, 2022

@raphCode Could you try #558 and see if that does what you'd like?

@raphCode
Copy link
Contributor

I gave it a quick spin and it looks good!
Thanks for the quick fix :)

I installed pudb from the main branch in my venv, so I will continue to test it and come back if I notice any further issues.

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

No branches or pull requests

2 participants