inducer / pudb

Full-screen console debugger for Python
https://documen.tician.de/pudb/
Other
2.94k stars 226 forks source link

local module imports fail after os.chdir #555

Closed raphCode closed 1 year ago

raphCode commented 1 year ago

Describe the bug

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

To Reproduce

import os

os.chdir("some_folder")
import some_module

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