DEV Community

Discussion on: How to convert .py to .exe? Step by step guide.

Collapse
 
eshleron profile image
Eshleron • Edited

Hi!
1.What I usually do is get an absolute path so the script\scripts always know where they are

import os
dir = os.path.dirname(__file__)
abs_path = os.path.join(dir, DB_DOCS_NAME)
variable = open(abs_path)
Enter fullscreen mode Exit fullscreen mode

2.If the main script is looking in the wrong place for other scripts then probably your imports are not correct.
Try to use this resource
realpython.com/absolute-vs-relativ...

Hope that I helped in some way

Some comments have been hidden by the post's author - find out more