[Tutor] trouble with pygtk and different users

Michael Lange klappnase at freenet.de
Sat Dec 20 21:29:46 EST 2003


On Sat, 20 Dec 2003 09:45:37 -0800 (PST)
Daniel Ehrenberg <littledanehren at yahoo.com> wrote:

> In trying to learn PyGTK, I wrote a simple launcher
> program to make it easier to run things as root. It is
> attached. There's a label at the top that should say
> that you should click on one of the following buttons
> to run them as root (or whatever user it is run under,
> the point is that you only have to type the password
> once). Then there are buttons to get to various
> programs and a quit button. It works some, but there
> are some problems.
> 
> The label, instead of saying which user owns the
> process, says which user is actually logged in. This
> is very confusing behavior. I think it's Linux's
> fault, but I still don't know how to fix it.
> 

I can guess here:
On my box I have no USERNAME variable at all if I am logged in as a normal user.
As root USERNAME is root. So maybe on your box it is vice versa, then you open a console
and USERNAME is set to "daniel" or whatever, then you su and USERNAME stays "daniel"
because for root there is nothing specified to overwrite this.
This happens when I su to root first and then su to "pingu":

[pingu at localhost pingu]$ echo $USERNAME

[pingu at localhost pingu]$ su
Password: 
[root at localhost pingu]# echo $USERNAME
root
[root at localhost pingu]# su pingu
[pingu at localhost pingu]$ echo $USERNAME
root
[pingu at localhost pingu]$ 

Maybe you just need to add:

USERNAME="root"
export USERNAME

to  /root/.bashrc


> When a program is launched from it, the GUI (of my
> Python script) freezes. Nothing can be done from it
> and if any other windows go over it, it is not
> updated. This isn't because Python is waiting for the
> program to finish; if I use PyShell to so
> os.system('nautilus'), it launches nautilus and
> returns 0, then there's the next command prompt.

I have never seen this behavior, my python shell freezes just like your app.
Use "nautilus &" instead.

Cheers (and a nice christmas)

Michael




More information about the Tutor mailing list