[pygtk] Setting application name in pygtk?

Dieter Verfaillie dieterv at optionexplicit.be
Wed Nov 8 05:42:03 WST 2006


On Tue, 2006-11-07 at 13:59 -0500, Willie Walker wrote: 
> Hi Dieter:
> 
> Thanks for the response!

np

> > Doing _only_ this leads to confusion as you are breaking simple commands
> > like ps or killall. That's why the prctl stuff is necessary.

Correcting myself: this is harmless. I've been confusing python's sys.argv[0]
and the systems argv stored in /proc/id/cmdline. Sorry about that :S

> 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.

You're correct on the original name being used by ps/killall even after
python's sys.argv[0] has been changed. Strangely at-poke and friends do
pick up this change as you've described. I'm curious how it does it...

> > 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). 

Correct. It would have to say Patrick is correct in his mail when he
said sometimes a hack is all you've got.

> It might be sufficient for our
> purposes, unless we can figure out how to use "-m" and that just makes
> our problem go away.

There's a recipe called "Executing modules inside packages with '-m'"
here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/307772
that works with python < 2.5. From 2.5 it (or something similar) is
built in.

> Thanks much for the insight and feedback.

In this case I would recommend playing with sys.argv[0] after all...

> Will

HTH,
sorry for the confusion,
Dieter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20061107/4d3243da/attachment.pgp


More information about the pygtk mailing list