From: <bri...@sy...> - 2005-04-27 20:53:05
|
resourceEditor.py has a bug in getCommandLineArgs() and it fails to collect the 'otherargs' value from the self.cmdLineArgs dictionary. (This is for PythonCard version: 0.8.1). This dictionary, cmdLineArgs is correctly populated in the "Run Options" window where command line options are chosen: Debug Menu, Logging, etc., concluding with an "Other args" text box It is a very simple patch to read that value into the 'args' variable in getCommandLineArgs(). Then everything correctly ends up in sys.argv. But that only begins my problems. Many of my programs have some check on argv, often by using optparse or the clever optionparse module which builds option names and defaults from my module docstring - self-documenting and self-validating options! (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278844 by Michele Simionato) Currently I am building a lot of my program arguments with SCons, which then calls the program, which simply asserts that the correct number of args have been passed, but even a simple assert of the length of argv now has to take into account PythonCard run option flags. I can change my options checkers to allow for the PythonCard run options. In fact, I must keep track of the PythonCard run options (-d, -l, -m, -n, -p, -s) and avoid using any of these for my own (grrr). Because I don't see any way to pass run options to PythonCard except thru sys.argv, I can't separate my own option use from PythonCard use. I would like to see a solution where I could pass option flags as a dict or list argument to model.Application and such an argument would bypass the configuration.configOptions use of sys.argv. (I think that is the only place where PythonCard looks at sys.argv) How I get the flags to my model.Application call would be my problem. To use the Run Options window, I would still need to accept something PythonCard-ish, but it would be less trouble than always incorporating the six (so far) PythonCard flags into my arg handling. Happy to say this is my biggest PythonCard problem this year. |