1

1) The example above works well but it does not open a terminal window.

import os

directory = os.path.join(os.path.join(os.path.expanduser('~')), 'Desktop')
os.chdir(directory+'/aaaa')
command = os.popen('npm install && gulp watch')
print(command.read())
print(command.close())

2) I found something like that but it does not work on macOS, I tried to change cmd by terminal and other but it does not work.

import os

command = "cmd"
os.system(command)

My goal is to launch a terminal to send orders, is it possible? If yes, how? Do you have some ideas to follow?

Benjamin Vbg
  • 89
  • 1
  • 12
  • Is it necessary for the terminal to open? Or is it ok if just the commands alone get executed? – Haran Rajkumar Mar 14 '19 at 08:07
  • Take a look at [this](https://askubuntu.com/questions/46627/how-can-i-make-a-script-that-opens-terminal-windows-and-executes-commands-in-the) thread. It gives you examples how you can call terminal window from `bash` and execute command in it. You just need to call it in Python – devaerial Mar 14 '19 at 08:14
  • I really need to have an open window to always have access. – Benjamin Vbg Mar 14 '19 at 08:20

0 Answers0