Reputation: 73
I am trying to run Test.py
using os.system(path)
where I specify the path of the file but I am getting an error. Basically, I want to run Test.py
from here and display the output.
import os
os.system(rf"C:\\Users\\USER\\OneDrive-Technion\\Research_Technion\\Python_PNM\\Sept15_2022\\220\\1\\Test.py")
The error is
The system cannot find the path specified.
Upvotes: 0
Views: 562
Reputation: 17740
you are passing a python file, not an executable. You can pass python yourfile.py
.
By the way, I would reconsider what you are doing, executing a python script from another python script is quite strange.
Upvotes: 1