![]() Registered Member ![]()
|
Hi there,
I am using the openafs client to connect to the AFS servers in our company. I have a little python script that gets afs running for me (loading the kernel module, starting the afs daemon, requesting afs tokens). Now I have this: - when I invoke the script on command line ... everything works perfect - but when I invoke the script via "clicking it" (I put a link to it into my Desktop folder) ... one of the operations will fail. Fail looks like this: 1) i am ussing the kdialog window to query the afs password 2) next is to invoke a "piped" system call to the klog binary to request a token step 2) fails when the script is invoked via "mouse click" ... gives me a bad return code that doesnt help a bit (i had the script print out the password; and it was OK, so its not that i am sending an invalid password). So, my conclusion: there must be subtle differences between these two actions. Any idea what it could be? |
![]() Administrator ![]()
|
Is the command to execute the script like the following:
Or are you directly clicking on the script? ( If you are then create a shortcut to it ( New > Link to Application ), only putting /bin/bash before the path to the script )
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Could it be that the script is dependent on some environment variables?
I have found that sometimes these can fail to be picked up from GUI invocation if a script doesn't explicitly point at a shell; for example having the following in the first line:
A script without this would inherit the shell environment if invoked from the command-line but may not from a GUI. |
![]() Registered Member ![]()
|
My script starts with:
and I changed the "invocation style" to link ... using /bin/bash -exec /home/myid/bin/start_afs.py and I tried: /home/myid/bin/start_afs.py Finally, i got the thing running ... with "advanced -> run with terminal" |
![]() Registered Member ![]()
|
The fact that it works with "run with terminal" smells of environment problems, but I don't know Python so I've no idea what it does with environment variables.
Assuming Python has a way to list environment variables, I'd suggest running (from a GUI) a script to dump the environment to a file, then compare it with what you see when you list the environment from a terminal session. If there's something obviously missing, you can force your script to pick it up either by explicitly setting it in the script or invoking it with (for example)
|
Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan, Sogou [Bot]