run exe and create exe

MRAB python at mrabarnett.plus.com
Sun Oct 11 12:03:51 EDT 2009


daved170 wrote:
> Hi everybody,
> I have 2 questions:
> 1) I created my python application. It has QT Gui. How can I make exe
> of it? I don't want everytime I run the file it'll open the command
> line window which does nothing.
> 
> 2) My Application suppose to be a client server app. Anyhow, for now
> It's running only on local host. I added a button that run the server
> file.
> my server file located at "c:\temp\server.py". It takes no arguments.
> 
> I tried the following codes at the push button function:
> 
> os.system(""c:\temp\server.py"") - It stuck my GUI. I guess that this
> function doesn't open a new proccess.
> 
"" is an empty string, so ""c:\temp\server.py"" is just the empty string
"" followed by c:\temp\server.py and then another empty string "".

> I also tried :
> os.spawnv(os.P_NOWAIT,"c:\temp\server.py");
> 
> It raised the following error:
> OSError: [Errno 8] Exec format error.
> 
> Any Idea what to do?
> 
A backslash starts an escape sequence, which you don't want because it's
a path. You should either double the backslashes:

os.spawnv(os.P_NOWAIT, "c:\\temp\\server.py")

or use a raw string:

os.spawnv(os.P_NOWAIT, r"c:\temp\server.py")



More information about the Python-list mailing list