Unfortunately, this cannot work since MacPyMOL embeds Python directly.

Your choices are as follows:

1. run your Python scripts from within MacPyMOL

2. launch PyMOL in command-line mode with your script
/Applications/MacPyMOL.app/Contents/MacOS/MacPyMOL -qc script.py

or 

3. compile the open-source code into Fink / X11 / Python via distutils.
This will enable 'import pymol' from within external python scripts. 

Cheers,
Warren

--
DeLano Scientific LLC
Subscriber Support Services
mailto:del...@delsci.info
 

> -----Original Message-----
> From: pymol-users-boun...@lists.sourceforge.net 
> [mailto:pymol-users-boun...@lists.sourceforge.net] On Behalf 
> Of Shatadal Ghosh
> Sent: Thursday, February 21, 2008 10:54 AM
> To: pymol-users@lists.sourceforge.net
> Subject: [PyMOL] Importing pymol modules into python
> 
> Hi All,
> 
> I am using MacPyMOL 0.99rc6 on Mac OS X leopard (10.5.1). I 
> wanted to import the pymol modules into python. As suggested 
> by MacPyMOL.app/pymol/modules/pymol/__init__.py I set the 
> following environment variables:
> 
> export 
> PYMOL_PATH=$PYMOL_PATH:/Volumes/Home/shatadal/Programs/MacPyMO
> L.app/pymol:
> export PYTHONPATH=$PYTHONPATH:$PYMOL_PATH/modules:
> 
> Then when I try to import pymol within python (e.g. as shown in
> http://www.rubor.de/bioinf/tips_python.html#pythonscr) I get 
> the following error:
> 
> $ python
> Python 2.5.1 (r251:54863, Oct  5 2007, 21:08:09) [GCC 4.0.1 
> (Apple Inc. build 5465)] on darwin Type "help", "copyright", 
> "credits" or "license" for more information.
> >>> import pymol
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File 
> "/Volumes/Home/shatadal/Programs/MacPyMOL.app/pymol/modules/py
> mol/__init__.py",
> line 353, in <module>
>     import _cmd
> ImportError: No module named _cmd
> >>>
> 
> When I try to run __init__.py from the bash commandline I get 
> the same error:
> 
> $ python __init__.py
> Traceback (most recent call last):
>   File "__init__.py", line 109, in <module>
>     import pymol
>   File 
> "/Volumes/Home/shatadal/Programs/MacPyMOL.app/pymol/modules/py
> mol/__init__.py",
> line 353, in <module>
>     import _cmd
> ImportError: No module named _cmd
> 
> Can anyone help me in getting to import the pymol module in python?
> 
> Thanks,
> Shatadal.
> 
> --------------------------------------------------------------
> -----------
> This SF.net email is sponsored by: Microsoft Defy all 
> challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pymol-users


Reply via email to