3

I am trying to compile my python script built in python 3 using pyqt5 module on windows 10 using pyinstaller which hides the windows while running.

To compile my script I executed following command:

pyinstaller --onefile --icon=app.ico --clean --noconsole app.py

But the executable I got didn't worked so again I compiled my script by following command:

 pyinstaller --onefile -w --icon=app.ico  app.py

Still the output executable is not working if --console/-w/--windowed argument is used.

How can I make my executable run without console?

this is the script i try to execute it

import threading
import subprocess
import sys
import time

f = open("build\\eco.txt", "x")
f = open("build\\sou.txt", "x")

def run_process(path):
    cmd = 'python %s' % path
    process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
    for line in iter(process.stdout.readline, ''):
        sys.stdout.write(line)


t1 = threading.Thread(target=run_process, args=('py1.py',))
t2 = threading.Thread(target=run_process, args=('py2.py',))
t3 = threading.Thread(target=run_process, args=('py3.py',))
t4 = threading.Thread(target=run_process, args=('py4.py',))
t5 = threading.Thread(target=run_process, args=('py5.py',))


#start
t1.start()
t2.start()
t3.start()
t4.start()
t5.start()

# Waiting
t1.join()
t2.join()
t3.join()
t4.join()
t5.join()

Thanks

dodu khaled
  • 43
  • 2
  • 7

1 Answers1

4

pass -w or --windowed or --noconsole flag to hide console.

Try GUI pyinstaller by installing auto py to exe. It makes you more easier to compile your script.

pip install auto-py-to-exe
  • i tried it as well but not working, it is using pyinstaller by the way – dodu khaled Feb 07 '19 at 11:10
  • 2
    **-w or --windowed or --noconsole** works perfectly for me to hide console. Maybe reinstalling pyinstaller might solve your problem –  Feb 07 '19 at 11:14
  • 1
    yes, it works with pyqt5. And you have to include files like pictures, etc in one directory (in case you have not ) –  Feb 07 '19 at 13:32