1

I have a GUI (created with PyQt5 and py2exe). This GUI takes input data (shp, images..) and uses them as parameters in softwares (ie FME). Whenever I launch a task on a software through the GUi, a cmd opens.

To launch the softwares, I use subprocess.Popen in my script with a shell=False parameter. Can that be the reason why the cmd opens ? Should I use os.system or something else to avoid having a cmd/DOS poping every time ?

Or is this not related to the way I launch anything ?

guy16
  • 233
  • 2
  • 3
  • 16
  • Possible duplicate of http://stackoverflow.com/questions/1813872/running-a-process-in-pythonw-with-popen-without-a-console?lq=1 or http://stackoverflow.com/questions/6390394/executing-subprocess-from-python-without-opening-windows-command-prompt – Blair Jun 11 '15 at 15:58

1 Answers1

1

This appears to have been solved in the questions that I linked. For reference, the solution appears to be as follows:

startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
return subprocess.Popen([command] + args, startupinfo=startupinfo).wait()
Community
  • 1
  • 1
Blair
  • 6,623
  • 1
  • 36
  • 42