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

Causes ModuleNotFoundError error in PyCharm #222

Open
pcauthorn opened this issue Aug 30, 2023 · 1 comment
Open

Causes ModuleNotFoundError error in PyCharm #222

pcauthorn opened this issue Aug 30, 2023 · 1 comment

Comments

@pcauthorn
Copy link

pcauthorn commented Aug 30, 2023

Steps to recreate:

  1. Create a project (Proj1) in PyCharm with a new venv. Create module and script (temp.t1.py) that creates a method
  2. Create another project (Proj2) in PyCharm and attach it using the same venv as Proj1.
  3. Create a script in Proj2 that imports the method
  4. Run method and confirm that it works
  5. Enable EnvFile in Configurations and rerun to see:
    from temp.t1 import print_hello
ModuleNotFoundError: No module named 'temp'

This error is new as of today

PyCharm 2023.1.4 (Professional Edition)

@emunsing
Copy link

I believe I'm also seeing this error, though not in as concisely tested a module: the behavior which I am seeing is that when EnvFile is enabled, python seems to lose awareness of the project source roots. The configured source roots are visible in os.environ['PYTHONPATH'] and sys.path, but do not seem to be traversed by Python when looking for modules (ModuleNotFoundError). Disabling/unchecking EnvFile resolves this issue (but doesn't allow the convenient import of envfile variables)

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

2 participants