
Hi There, I am trying to call a script with Chimera commands(saved as sample.py file) in another python program using os.system("chimera --nogui --nostats sample.py") and I get an module load error as below, import chimera ImportError: No module named chimera However, if I call the script with chimera it works, for eg., chimera --nogui --nostats sample.py typed directly in terminal is working. Can anybody help fix this error? Thanks in advance, Best Regards, Subha

(I assume you meant --nostatus) For me the simple test of a file with:
import os os.system("chimera --nogui --nostatus") works just fine. So it's probably something about your particular setup that is tickling this bug.
It might be the directory that you're running the script in, it might have python modules/packages that conflict with chimera's. Or it might something in the environment. Chimera tries to protect its python from the user's environment, but maybe we missed something. Also double check that the chimera you're invoking is the one you're expecting -- try using an absolute path to chimera while you're debugging this. HTH, Greg On 06/20/2016 01:18 PM, Subha Kalyaanamoorthy wrote:
Hi There,
I am trying to call a script with Chimera commands(saved as sample.py file) in another python program using os.system("chimera --nogui --nostats sample.py") and I get an module load error as below,
import chimera
ImportError: No module named chimera
However, if I call the script with chimera it works, for eg., chimera --nogui --nostats sample.py typed directly in terminal is working.
Can anybody help fix this error?
Thanks in advance,
Best Regards,
Subha
_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Hi Greg, Thanks for the kind reply. Sorry about the typo. The environment variables of the system seem fine to me. I also tried calling Chimera from the same directory as the script and its working fine. However, calling the chimera script using "python sample.py" doesn't work and using absolute path to chimera didn't help too. I tried installing pychimera, but end up with the same kind of error when I try pychimera -i import pychimera ImportError: No module named pychimera Couldn't understand what's going on with these import modules. I would greatly appreciate any suggestions to solve this. Thanks, Subha On Mon, Jun 20, 2016 at 4:05 PM, Greg Couch <gregc@cgl.ucsf.edu> wrote:
(I assume you meant --nostatus)
For me the simple test of a file with:
import os os.system("chimera --nogui --nostatus")
works just fine. So it's probably something about your particular setup that is tickling this bug.
It might be the directory that you're running the script in, it might have python modules/packages that conflict with chimera's. Or it might something in the environment. Chimera tries to protect its python from the user's environment, but maybe we missed something. Also double check that the chimera you're invoking is the one you're expecting -- try using an absolute path to chimera while you're debugging this.
HTH,
Greg
On 06/20/2016 01:18 PM, Subha Kalyaanamoorthy wrote:
Hi There,
I am trying to call a script with Chimera commands(saved as sample.py file) in another python program using os.system("chimera --nogui --nostats sample.py") and I get an module load error as below,
import chimera
ImportError: No module named chimera
However, if I call the script with chimera it works, for eg., chimera --nogui --nostats sample.py typed directly in terminal is working.
Can anybody help fix this error?
Thanks in advance,
Best Regards,
Subha
_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
-- Dr. Subha Kalyaanamoorthy Post Doctoral Fellow Faculty of Pharmacy and Pharmaceutical Sciences University of Alberta Edmonton, Canada.

Change your os.system("chimera ...") to os.system("env PYTHONVERBOSE=1 chimera ...") and the debugging output might give you a clue. Feel free to send me the voluminous output (and just me, not the whole chimera-users list), and I'll let you know if I spot anything. -- Greg On 06/20/2016 03:27 PM, Subha Kalyaanamoorthy wrote:
Hi Greg,
Thanks for the kind reply. Sorry about the typo.
The environment variables of the system seem fine to me. I also tried calling Chimera from the same directory as the script and its working fine.
However, calling the chimera script using "python sample.py" doesn't work and using absolute path to chimera didn't help too.
I tried installing pychimera, but end up with the same kind of error when I try pychimera -i import pychimera
ImportError: No module named pychimera
Couldn't understand what's going on with these import modules.
I would greatly appreciate any suggestions to solve this.
Thanks,
Subha
On Mon, Jun 20, 2016 at 4:05 PM, Greg Couch <gregc@cgl.ucsf.edu <mailto:gregc@cgl.ucsf.edu>> wrote:
(I assume you meant --nostatus)
For me the simple test of a file with:
import os os.system("chimera --nogui --nostatus")
works just fine. So it's probably something about your particular setup that is tickling this bug.
It might be the directory that you're running the script in, it might have python modules/packages that conflict with chimera's. Or it might something in the environment. Chimera tries to protect its python from the user's environment, but maybe we missed something. Also double check that the chimera you're invoking is the one you're expecting -- try using an absolute path to chimera while you're debugging this.
HTH,
Greg
On 06/20/2016 01:18 PM, Subha Kalyaanamoorthy wrote:
Hi There,
I am trying to call a script with Chimera commands(saved as sample.py file) in another python program using os.system("chimera --nogui --nostats sample.py") and I get an module load error as below,
import chimera
ImportError: No module named chimera
However, if I call the script with chimera it works, for eg., chimera --nogui --nostats sample.py typed directly in terminal is working.
Can anybody help fix this error?
Thanks in advance,
Best Regards,
Subha
_______________________________________________ Chimera-users mailing list:Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> Manage subscription:http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
-- Dr. Subha Kalyaanamoorthy Post Doctoral Fellow Faculty of Pharmacy and Pharmaceutical Sciences University of Alberta Edmonton, Canada.
_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Just to follow up on the chimera-users list, the bug was in the script that invoked chimera via os.system("chimera ...."). It had an "import chimera" in it, which failed and wouldn't have helped anyway since chimera was being used as an external program, not as a module. -- Greg On 06/20/2016 03:50 PM, Greg Couch wrote:
Change your os.system("chimera ...") to os.system("env PYTHONVERBOSE=1 chimera ...") and the debugging output might give you a clue. Feel free to send me the voluminous output (and just me, not the whole chimera-users list), and I'll let you know if I spot anything.
-- Greg
On 06/20/2016 03:27 PM, Subha Kalyaanamoorthy wrote:
Hi Greg,
Thanks for the kind reply. Sorry about the typo.
The environment variables of the system seem fine to me. I also tried calling Chimera from the same directory as the script and its working fine.
However, calling the chimera script using "python sample.py" doesn't work and using absolute path to chimera didn't help too.
I tried installing pychimera, but end up with the same kind of error when I try pychimera -i import pychimera
ImportError: No module named pychimera
Couldn't understand what's going on with these import modules.
I would greatly appreciate any suggestions to solve this.
Thanks,
Subha
On Mon, Jun 20, 2016 at 4:05 PM, Greg Couch <gregc@cgl.ucsf.edu <mailto:gregc@cgl.ucsf.edu>> wrote:
(I assume you meant --nostatus)
For me the simple test of a file with:
import os os.system("chimera --nogui --nostatus")
works just fine. So it's probably something about your particular setup that is tickling this bug.
It might be the directory that you're running the script in, it might have python modules/packages that conflict with chimera's. Or it might something in the environment. Chimera tries to protect its python from the user's environment, but maybe we missed something. Also double check that the chimera you're invoking is the one you're expecting -- try using an absolute path to chimera while you're debugging this.
HTH,
Greg
On 06/20/2016 01:18 PM, Subha Kalyaanamoorthy wrote:
Hi There,
I am trying to call a script with Chimera commands(saved as sample.py file) in another python program using os.system("chimera --nogui --nostats sample.py") and I get an module load error as below,
import chimera
ImportError: No module named chimera
However, if I call the script with chimera it works, for eg., chimera --nogui --nostats sample.py typed directly in terminal is working.
Can anybody help fix this error?
Thanks in advance,
Best Regards,
Subha
_______________________________________________ Chimera-users mailing list:Chimera-users@cgl.ucsf.edu <mailto:Chimera-users@cgl.ucsf.edu> Manage subscription:http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
-- Dr. Subha Kalyaanamoorthy Post Doctoral Fellow Faculty of Pharmacy and Pharmaceutical Sciences University of Alberta Edmonton, Canada.
_______________________________________________ Chimera-users mailing list:Chimera-users@cgl.ucsf.edu Manage subscription:http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
_______________________________________________ Chimera-users mailing list: Chimera-users@cgl.ucsf.edu Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
participants (2)
-
Greg Couch
-
Subha Kalyaanamoorthy