Where’s your code? Debugging ImportErrors in your Docker image

published 29.06.2020 02:00

by Itamar Turner-Trauring from pythonspeed.com
Image of article 'Where’s your code? Debugging ImportErrors in your Docker image'

Your code runs fine on your computer, but when you try to package it with Docker you keep getting s: Python can’t find your code.

What matters is that the code you’re importing is in the same directory as the main script you’re running.

Either install all your code with , or make sure it’s all in the same directory.

If you’re using or , and you haven’t just ed everything, then you need to follow the same requirements as step 3: the imported code needs to be in the same directory as the main script.

If your code is a package, you need to be in the directory containing the package: Make sure your current working directory is the same as the code: To recap, here are the suggested actions to take to prevent s: Want to learn more debugging techniques for common Docker packaging problems?