ImportError: No module named ... and creating a new folder

Answered

I am trying to import a module and getting an ImportError. I am using a remote Docker container as my Python interpreter and I am passing the directory in my volume bindings and PYTHONPATH environment variable. The module I'm trying to import is in a path like my/path/mod/src/py/mod... The volume binding is for /my/path/mod/src/py/ and I'm trying to import mod. Every time I run the file, a new, empty, folder is created in /my/path/mod/src/ named "py" - so there are two py folders. One py folder has all my files in it and the new one is empty. I don't know why this is happening. I have other modules in similar situations (/my/path/other_mod/src/py/other_mod) that I can import without any problems.

2 comments
Comment actions Permalink

Hi Julius,

Do you specify this particular directory in volume bindings in Run/Debug configuration?

Most likely there is a wrong binding defined. I'm not aware of any other settings which may cause the behavior.

0
Comment actions Permalink

Sorry for the delay - I believe I did so perhaps that was the problem. I've switched to VSCode so thanks for trying to help but you can disregard this.

0

Please sign in to leave a comment.