I have a file called main.py
and has the following code:
from os import system
from time import sleep
from datetime import datetime
while True:
print(datetime.now(),"-+- Starting")
system('file.py')
print(datetime.now(),"-+- Crash")
sleep(300)
However, if I try to execute it from the shell using python3 main.py
I get the following error:
sh: 1: file.py: not found
^CTraceback (most recent call last):
File "main.py", line 14, in <module>
sleep(300) # sleep for 5 minutes
file.py
as well as main.py
are both located in the same directory under /home/username/Documents/py-script/
.
I even changed system('file.py')
to the line below but I still can't execute file.py
.
system('/home/username/Documents/py-script/file.py')
The program runs fine on windows, are there any additional steps I need to take in order to make it work on my Ubuntu desktop (not VM). I assigned 744 to both files as well.