I've written a program which hijacks the optparse module so that it'll bring up a dialog box showing the options for the program in question using wxPython.  It uses the dynamic nature of python to change which optparse module it'll use, essentially. It works like a charm, I can point my program to any python (.py) file that uses optparse and it'll show me the options in a dialog where I can click on checkboxes and fill edit boxes instead of doing the normal thing through the command line.
It's nice because you can leave the original program as-is and continue to use that program passing commands at the command line, yet you have the option of running my wxOptparse program to show the options with a GUI.
The only thing is that it doesn't work with .py programs that have been converted to .exe files. If I could just get at the .pyc files embeded within,  I figure I might still be able to do it by expanding out the files in the .exe.


On 7/31/05, Michael Foord <mike@pcblokes.com> wrote:

I'm emailing from a PDA - so apologies for any crappy html in the mail.

-----Original Message-----
   >From: "Scott Kirkwood"<scottakirkwood@gmail.com >
   >Sent: 31/07/05 16:46:07
   >To: "py2exe-users@lists.sourceforge.net"<py2exe-users@lists.sourceforge.net >
   >Subject: [Py2exe-users] Running a py2exe'd program through execfile()
   >I'd like to able to call another program from my program using execfile() so
   >I can pass my globals and locals to the child program. I'm hoping there's a
   >way I can extract the .pyc file from within the .exe and maybe run it that
   >Any ideas?

I'm assuming you are creating *both* programs - rather than using a py2exe created by someone else ? Anyway, if I understand you - the second script needs to run as an executable *and* by execfile so you can set it's locals/globals ?

Instead of using py2exe on the second script directly I'd create a small loader script that runs it for you. That leaves it as a 'pyc' file that you can execfile from another script....