Freezing a dual-mode (GUI and console) application using cx_Freeze
- by Mridang Agarwalla
Hi,
I've developed a Python application that runs both in the GUI mode and the console mode. If any arguments are specified, it runs in a console mode else it runs in the GUI mode.
I've managed to freeze this using cx_Freeze. I had some problems hiding the black console window that would pop up with wxPython and so I modified my setup.py script like this:
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(
name = "simple_PyQt4",
version = "0.1",
description = "Sample cx_Freeze PyQt4 script",
executables = [Executable("PyQt4app.py", base = base)])
This works fine but now when I try to open up my console and run the executable from there, it doesn't output anything. I don't get any errors or messages so it seems that cx_Feeze is redirecting the stdout somewhere else.
Is is possible to get it to work with both mode? Nothing similar to this seems to be documented anywhere. :(
Thanks in advance.
Mridang