On 8/1/05, Brian Dorsey <firstname.lastname@example.org> wrote:
On 01/08/05, Scott Kirkwood <email@example.com> wrote:
> 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.
The only thing I can think of would be a bad hack... make a copy of
the app and it's lib folder, replace the optparse.pyc file with your
custom one, run the app, and then delete the copy on exit. But, I
don't like that. It'd be much better if there were a way to inject
sys.modules after py2exe has started, but before it
starts the main python script.
In any case, that sounds like a very useful script! It it something
that you'd be willing and able to share?
Yes, I'm almost ready for prime-time. It'll be GPL'd or
whatever. Although I think you should release early and often I also
think the first version should be usable.
I'll probably call it wxOptParse