I feel uncomfortable using cmd and I want to use commands for my python scripts, wondering if there is any way to not use cmd for os.system() and instead changes that to my ubuntu terminal. Thanks!
I feel uncomfortable using cmd and I want to use commands for my python scripts, wondering if there is any way to not use cmd for os.system() and instead changes that to my ubuntu terminal. Thanks!
2
Answers
Per the Python docs,
os.system(<command>)
executes<command>
in a subshell, which is system dependent. There is no way to makeos.system()
run a Windows specific command as a Unix equivalent. You may be interested in Python’s sys moduleIf you edit your question with more specific details as to what commands you are trying to run I might be able to provide better help.
os.system() normally runs system commands depending the OS you are running the script.
However, you can read this article on Stackoverflow or try to follow further steps to setup an effective environment for Python on Ubuntu on Windows.