0

I'm having some troubles trying to schedule the execution of one project.

The structure is:

main folder
 |- lib
 |   |- file1.py
 |   |- file2.py
 |
 |- data
 |   |- file.csv
 |
 |- temp
 |   |- file.json
 |
 |-main.py

The contrab line is:

*/5 * * * * python3 /home/myName/main_folder/main.py

I've been trying this command line with simple python scripts without dependences and works fine. The problem is that in this case the main.py import classes and functions inside lib and I think it can deal with it.

On my main.py I'm importing like this from lib import file1, file2. Exists another way maybe using os that the program knows the absolute path?

Lleims
  • 1,275
  • 12
  • 39
  • quickfix: */5 * * * * cd /home/myName/main_folder/; python3 main.py – Yuri Jul 06 '21 at 13:51
  • check this https://stackoverflow.com/questions/1046628/importing-python-modules-from-different-working-directory – Yuri Jul 06 '21 at 13:53

1 Answers1

1

Please try to add an empty file named: __init__.py in lib directory.