I try to write some Data in a CSV file by a Python3 script.
If I run this direct in the CMD it works very well, but if i run it by cron ( setted up by
crontab -e) it does not work.
Now I've found out that I need the direct path (hardcoded in my code as a constant string) to this file.
But my first approach was confusing me. I run the command
Path(os.getcwd()).joinpath('Data/test.csv') and get the correct path
/home/pi/Documents/Project/Data/test.csv. But as i run it by a cron, the path was
The project is located at
Path(os.getcwd()).joinpath('Data/test.csv') returns an other path, than a direct call by cmd?
What could i change that i've the same behavior in a cron and in a comandline call of my scirpt?
This is my crontab entry:
00 9,15 * * * python3 /home/pi/Documents/Projects/temperatureCheck/temperatureCheck.py