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

Debugger cannot import custom packages from directory other than that of main file #57

Open
mlangiu opened this issue Aug 13, 2020 · 0 comments

Comments

@mlangiu
Copy link

mlangiu commented Aug 13, 2020

It appears that python-debugger cannot be used to debug custom packages; steps to reproduce:

  • Set up the following directory structure, e.g., in /tmp/example:
    ├── maindir
    │   └── main.py
    └── mypackage
        └── __init__.py
    
  • contents of main.py
import os
print(os.listdir())
import mypackage  # or similarly from . import mypackage
  • contents of __init__.py
print("This worked!")
  • Open main.py in atom
  • Launch a debugger with the following options:
    • Program: /tmp/example/maindir/main.py
    • Python Path: /usr/local/bin/python3
    • Cwd: /tmp/example
    • Automatically Stop after launch
  • Hit F8 to start
  • Now for some reason I need to type something into the debugger's console and execute it to get the debugger running this may be an issue of itself!
  • executing the second line of main.py confirms that I am in /tmp/example/ yet executing the third one fails with
    Traceback (most recent call last):
    Python Debugger
    4:07:41 PM
    File "/tmp/example/maindir/main.py", line 3, in <module>
    Python Debugger
    4:07:41 PM
      import mypackage
    Python Debugger
    4:07:41 PM
    ModuleNotFoundError: No module named 'mypackage'
  • when moving main.py to Cwx (/tmp/example) the import works!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant