View previous topic :: View next topic |
Author |
Message |
urcindalo l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
Joined: 08 Feb 2005 Posts: 623 Location: Almeria, Spain
|
Posted: Fri Feb 12, 2010 5:37 am Post subject: Strange sudo / bash / python error |
|
|
Thanks for reading this.
I have this really strange problem when launching an application with sudo: Code: | $ sudo pymol
/usr/bin/python2.6: can't open file '/__init__.py': [Errno 2] No such file or directory |
However, the pymol command is a shell script: Code: | $ cat /usr/bin/pymol
#!/bin/sh
python -O ${PYMOL_PATH}/__init__.py $* |
The PYMOL_PATH value is defined for both my regular user and root, and the file __init__.py exists within the path: Code: | $ echo $PYMOL_PATH
/usr/lib64/python2.6/site-packages/pymol
...
# echo $PYMOL_PATH
/usr/lib64/python2.6/site-packages/pymol
# ls -la /usr/lib64/python2.6/site-packages/pymol/__init__.py
-rw-r--r-- 1 root root 20178 jul 7 2009 /usr/lib64/python2.6/site-packages/pymol/__init__.py |
However, I can launch the program being root, or my regular user, just by issuing the command specified in the launching script: Code: | # python -O ${PYMOL_PATH}/__init__.py $*
PyMOL(TM) Molecular Graphics System, Version 1.2r2pre.
Copyright (C) 2009 by DeLano Scientific LLC.
All Rights Reserved.
Created by Warren L. DeLano, Ph.D.
PyMOL is user-supported open-source software. Although some versions
are freely available, PyMOL is not in the public domain.
If PyMOL is helpful in your work or study, then please volunteer
support for our ongoing efforts to create open and affordable scientific
software by purchasing a PyMOL Maintenance and/or Support subscription.
More information can be found at "http://www.pymol.org".
Enter "help" for a list of commands.
Enter "help <command-name>" for information on a specific command.
Hit ESC anytime to toggle between text and graphics.
OpenGL graphics engine:
GL_VENDOR: ATI Technologies Inc.
GL_RENDERER: ATI Mobility Radeon HD 4500 Series
GL_VERSION: 2.1.9116
Note: Radeon HD cards tend not to run PyMOL well.
Use nVidia or Intel instead, if OpenGL glitches occur.
Attempting to compensate for known issues...
Detected 2 CPU cores. Enabled multithreaded rendering.
Created temporary files directory: /root/.ADplugin
PyMOL: normal program termination. |
Finally, to make things even more strange, I run another box, the configuration of which is the same, where I can normally launch pymol with root priviledges through sudo.
Any help is greatly appreciated. I'm really clueless here.
Thanks. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
bombcar Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/gallery/Monkey Island/Monkey_Island_-_Herman_Toothrot.gif)
Joined: 08 Apr 2003 Posts: 453 Location: Wisconsin
|
Posted: Fri Feb 12, 2010 6:10 am Post subject: |
|
|
sudo isn't loading environmental variables for some reason, or isn't passing them on. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
urcindalo l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
Joined: 08 Feb 2005 Posts: 623 Location: Almeria, Spain
|
Posted: Fri Feb 12, 2010 6:19 am Post subject: |
|
|
bombcar wrote: | sudo isn't loading environmental variables for some reason, or isn't passing them on. |
Thanks for your help. Yes, I think so, but I can't guess why
Does anybody know what could I check out? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Axilatis n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/17698278754d78f36bc1b2c.jpg)
Joined: 22 Oct 2010 Posts: 54 Location: Belgique
|
Posted: Mon Mar 21, 2011 10:46 pm Post subject: |
|
|
i know it's very very old topic but if someone's got the same problem, the solution is to :
then
Code: | env-update && source /etc/profile |
after emerging pymol ![Very Happy :D](images/smiles/icon_biggrin.gif) _________________ Gentoo : Build your own excitement. Piece. By. Piece. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
Joined: 06 Mar 2007 Posts: 23093
|
Posted: Tue Mar 22, 2011 2:41 am Post subject: |
|
|
No, that is not the relevant solution here. In the problem described by the OP, the environment variables were correctly set in the profile and in the running shell. However, sudo scrubbed the environment. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
AngelKnight Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 14 Jan 2003 Posts: 127
|
Posted: Wed Mar 23, 2011 6:01 am Post subject: |
|
|
urcindalo wrote: | bombcar wrote: | sudo isn't loading environmental variables for some reason, or isn't passing them on. |
Thanks for your help. Yes, I think so, but I can't guess why
Does anybody know what could I check out? |
"sudo -L" and/or check on the sudoers file and see what the precise configuration is w.r.t. how sudo handles environment variables.
As a dumb test, have a test script with just:
Code: | #!/bin/sh
echo "PYMOL_PATH is $PYMOL_PATH"
|
Set it executable somewhere and run via sudo. This is a quicker way to test if sudo's stripping your environment. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|