local module imports fail after os.chdir #556
Unanswered
raphCode
asked this question in
Troubleshooting
Replies: 1 comment 1 reply
-
May I ask why this was moved to a discussion? Is it not considered a pudb bug? In my use case I use the hydra framework to import functions from user-specified modules. This happens at runtime in my code, after hydra has changed to a new working directory. Under pudb a previously working configuration now fails with |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the bug
After
os.chdir()
local modules cannot be imported when run under pudb and raiseModuleNotFoundError
.To Reproduce
some_module.py
(empty)some_folder/
(empty directory)test.py
content as follows:pudb3 test.py
some_module
failsExpected 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
Beta Was this translation helpful? Give feedback.
All reactions