I want to run a python script when booting my NVIDIA Nano Jetson.
The python script prints LSTM generated text to a receipt printer with the following command:
While True:
textfile = open("test1.txt","w")
poem = on_epoch_end()
print(poem)
textfile.write(poem)
subprocess.run(["lp","-o", "media=X72MMY2000MM", "test1.txt"])
on_epoch_end() generates the text using Keras.
This works fine when running the script manually, it prints pieces of text continually on the receipt printer. But when I set crontab to run the script at boot with the following code:
@reboot (sleep 80 && cd /home/lauge/Downloads/lstmtextfinal/ && python3 generator.py >> /home/lauge/generator_log.txt &)
Nothing happens. I added the sleep timer to ensure that everything is ready for the script to run. When checking whether the scripts run at startup with:
ps ax | grep generator.py
It shows that both the sleep timer is working, and after the timer has run out, that the script is running in python3. I'm not sure what I'm doing wrong at this point.