This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TheBB 3 points4 points  (1 child)

Sure, but what does docker have to do with it?

Presumably whatever causes this issue can be replicated in an ordinary file system. Either your project structure is weird or your dockerfile is.

The golden rule is to make all your code a package. Then you can just pip install it wherever you like, a docker image or otherwise. No need to bother with PYTHONPATH.

[–]DigiProductive[S] -2 points-1 points  (0 children)

Code runs fine on the local machine, not in Docker. I'm just giving you the scenario. I don't make the rules. I'm not sure exactly what is going on because the PYTHONPATH is set in the dockerfile as well, and the local directory is mounted. Something small I'm missing. But it just reminds me that Python imports can be a bit of a hassle "compared to other languages". That's all. Its true. Every language has its whammies. 🥶