Rubens, Thanks for your help!
On Tue, Jun 15, 2004 at 08:27:52PM -0700, Rubens Ramos wrote: > > I guess the short answer to what you are trying to do is - it is > not possible, due to some constraints in how the popt wrappers were > written (please see the "technical yaddayadda" if you are interested). > > However, one workaround is to do it this way: > > ./myprog -i "file1,file2,file3" -f "format1,format2,format3" > > and then split the arguments after the parsing is done. Would that > work for you? I guess so, but it's uglier. Not only that, the actual problem is that I want the program to guess formats if they are not explicitly supplied on the command line. So it should be possible to say ./myprog -i file1 -i file2 -f format2 which means that the file1's format should be guessed. In your scenario, -i "file1,file2" -f "format2" becomes uncertain: is format2 applying to file1 or file2? > ***** Technical yaddayadda ***** > > Currently there is no way to use the pygtk popt bindings in a > loop like what you can do in C - the wrappers do that > for you, so the only option is to use get_popt_args() after > gnome.init() OR gnome.popt_parse(). > > There is no parallel between that (the C loop method) and the Python > interface. I see. > The misterious flags in the Python table are the POPT_ARGFLAG_* > constants defined in popt.h and explained in the man page. Oh, the man page is actually quite good, thanks! > And the callback functionality for the popt tables (as described > in the popt manpage) is not available in pygtk, as it is also > used internally by the wrappers - by the way, as I can see it, this > is also the only way you would be able to implement this: > > ./myprog -i file1 -f format1 -i file2 -f format2 -o file3 -f format3 > > in C. Pity. Let me ask you this: I had no problem parsing the above type of arguments using getopt. However, I thought I'd want to use popt, if not for anything else then just to have the application options appear on ./myprog -- help and ./myprog --usage. What is the downside of this cheating: passing popt table to the gnome.init() (so that --help and --usage list my options) while actually using getopt for parsing the command line? Unless I'm missing something, this is the best of both worlds, at least for my situation, isn't it? Thanks again, Alex -- Alexander Roitman http://ebner.neuroscience.umn.edu/people/alex.html Dept. of Neuroscience, Lions Research Building 2001 6th Street SE, Minneapolis, MN 55455 Tel (612) 625-7566 FAX (612) 626-9201
signature.asc
Description: Digital signature
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
