I want run another python file in my code.It's simple:
import os
command = "python3 简易时钟.py"
os.system(command)
When I use Pycharm, it will run normally. When I use IDLE, nothing happened. Why? macOS 10.15.7 python 3.7.9
This works in idle(Windows) for me. Try using the exact path of the file.
Like
command = r"C:\Users\(your_username)\Documents\python3 简易时钟.py"
or whatever the path of the file is.
Or if the python3 简易时钟.py file doesn't generate any output file the python3 简易时钟.py file will run and get closed in the background once it is completed execution.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.