0

I have created a GUI using PyQt5. The aim of the GUI is to pass some input data (images, shapefiles etc) and to use them in softwares (GIS mostly).

To launch the GIS I use the subprocess.Popen command line. I have used py2exe to create my app and my problem is that a DOS/cmd opens whenever I launch an operation.

My setup file looks like this :

from distutils.core import setup
import py2exe
setup(    
      windows=[{'script':'D:\App\projet.pyw',
                'options':{'py2exe':{'includes':['sip', 'PyQt5.QtGui', 'PyQt5.QtCore', 'PyQt5.QtWidgets', 'qwindows']}},
                'icon_resources':[(1, 'D:\App\images\logo.ico')]

            }]
      )

A cmd window stills open, eventhough I use windows instead of console. And I tried with both .py and .pyw .

So I'm not sure if this is py2exe related or if it's because I am launching softwares through my GUI, but I would like the cmd window not to open, just the GUI to be opened.

guy16
  • 233
  • 2
  • 3
  • 16
  • Does it happen if you launch the .exe directly? If not, it's a problem in your GUI launching it. – ThiefMaster Jun 11 '15 at 14:44
  • @ThiefMaster Yes it happens when I launch the .exe, when i'm using the GUI launched by the .exe – guy16 Jun 11 '15 at 15:01
  • Can you please clarify: Is it the `subprocess.Popen` that causes the terminal window to open or does it happen even when the subprocess launching code is removed from your application? – three_pineapples Jun 12 '15 at 05:28
  • @three_pineapples i dont know if it's the subprocess that causes the terminal window to open, i haven't tried to remove it (because i need it). I've read about STARTUPINFO, maybe it will fix the problem (what do you think ?) – guy16 Jun 12 '15 at 07:38
  • I would suggest you do some basic debugging then to find out what is causing the terminal window to appear, and then update your question. It's pretty pointless speculating. – three_pineapples Jun 12 '15 at 08:37
  • Resolved the problem ! – guy16 Jun 12 '15 at 09:05

1 Answers1

0

Got the answer !

Running a process in pythonw with Popen without a console

Source : http://code.activestate.com/recipes/409002/

Community
  • 1
  • 1
guy16
  • 233
  • 2
  • 3
  • 16