I have the following Python project structure and running my script from the root directory using python -m image_batch_processor.main
works. Also testing with the unittest module from the root using discovery
works fine
.
├── README.md
├── image_batch_processor
│ ├── __init__.py
│ ├── argument_parser.py
│ ├── data_collection
│ │ ├── __init__.py
│ │ └── image_file_finder.py
│ ├── image_batch_processor.py
│ ├── image_processing
│ │ ├── image_modification.py
│ │ ├── preview_label_creator.py
│ │ └── utilities
│ └── main.py
└── tests
However within every file I get an "import could not be resolved" from the LSP - as for example for imports within main.py:
from image_batch_processor.argument_parser import argument_parser
from image_batch_processor.data_collection.image_file_finder import ImageFileFinder
from image_batch_processor.image_batch_processor import ImageBatchProcessor
But also imports of installed modules like numpy or cv2 show the same error even though they show up in pip list
It's not a major issue since the code is working, but I'd like to get rid of the error messages.
I looked it up and sometimes the right interpreter had to be chosen in the virtual environment, however I'm using pyenv and my environment is active and the correct interpreter is chosen.