py2exe - return information from .exe program
Peter Abel
p-abel at t-online.de
Wed Jan 29 12:48:52 EST 2003
mirandacascade at yahoo.com (Miranda Evans) wrote in message news:<59e5b87.0301281315.7802eaf3 at posting.google.com>...
> Assume xyz.exe is a program that was produced from xyz.py by running
> the py2exe utility. Currently, xyz.exe displays information on the
> screen, but it does not return information to the calling program.
> Can xyz.py be modified so that xyz.exe returns a value (e.g. a string)
> to the process that called it? Can anyone point me to a sample .py
> script which, when 'compiled' with py2exe produces a .exe that returns
> information to the calling program? Thank you.
If you want to get the exit-code of the called program
say:
>>> print os.system('dir c:\\temp')
0
If you want to get the output of the called program
say:
>>> print os.popen('dir c:\\temp').read()
Datentrger in Laufwerk C: ist BOOT
Datentrgernummer: 042E-13F1
Verzeichnis von c:\temp
21.11.2002 15:34 <DIR> .
21.11.2002 15:34 <DIR> ..
0 Datei(en) 0 Bytes
2 Verzeichnis(se), 1.446.723.584 Bytes frei
If you want to exchange information between two processes
as between to subroutines by para list, you have to do
a little bit more.
You have to do something like:
- sockets or
- shared memory or
- named pipes
Peter
More information about the Python-list
mailing list