Hi Dieter: Thanks for the response!
> > It's the "-c" that we're trying to make more human consumable. It looks > > like PyGtk is grabbing arg[0] as a default for the application name. > > PyGtk has nothing to do with it. It's the python interpreter which > populates the sys.argv list (1) Understood that the interpreter populates sys.argv. What I was referring to is that PyGtk (or ATK) was grabbing argv[0] as the default for the application name (versus who is populating argv). The "-m" option looks like it might be close to sufficient in terms of how it sets argv[0] to the full name of the located module, but I've never been able to get it to work with something in a package. For example, orca lives in the orca package and the orca.orca module contains the 'main' for orca. I've never figured out the magic incantation for -m. "python -m orca.orca" seems like the logical thing, but it doesn't work for me. > > It looks like we might be able to do this *before* the import of gtk: > > > > import sys > > sys.argv[0] = "Orca" > > Doing _only_ this leads to confusion as you are breaking simple commands > like ps or killall. That's why the prctl stuff is necessary. Do you mean that ps and killall will end up showing the modified argv[0] name? I just did a test on Ubuntu Edgy and I don't see this behavior. In addition, killall continues to do the right thing. > This whole thing is nothing more than a non-portable hack (3). It's up > to you guys if you're willing to use it. With the argv[0] hack, however, I think we cover the platforms we care most about (Solaris and Linux). It might be sufficient for our purposes, unless we can figure out how to use "-m" and that just makes our problem go away. Thanks much for the insight and feedback. Will > > > Will > > Dieter > > (1) http://docs.python.org/tut/node4.html, 2.1.1 Argument Passing > Actual code proving this here (lines 461-470): > http://svn.python.org/projects/python/trunk/Modules/main.c > > (2) summer of 2002 is the earliest reference i've found: > > http://groups.google.com/group/comp.lang.python/msg/60cc39679b52df4b?hl=en&lr=&ie=UTF-8&oe=UTF-8&rnum=1) > > (3) works on Linux 2.6 from 4 september 2005 and up (4) > > (4) similar tricks exist for other OSs. Don't ask, I don't know ;) > _______________________________________________ > pygtk mailing list [email protected] > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
