The below is dependent on how you import pybel

you did "import pybel", which imports the pybel functions with a "pybel." 
prefix as shown in your efforts to run things.

Some of the examples in the documentation implicitly do "from pybel import *" 
so the functions are imported without a prefix.

-David

> On Jul 8, 2016, at 11:14 AM, Dan Smith <s...@bellsouth.net> 
> 
> Importing pybel and openbabel works now. I tried to work through some of the 
> examples on the web 
> (http://openbabel.org/docs/current/UseTheLibrary/Python_Pybel.html).  The 
> examples do not work exactly as written.  For instance, I cannot use the 
> command “read string”, but I can use “pybel.readstring”.
> 
> >>> mymol = readstring("smi", "CCCC")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> NameError: name 'readstring' is not defined
> >>> mymol = pybel.readstring("smi", "CCCC")
> >>> print mymol.molwt
> 58.1222
> 
> Is this normal or is there something wrong with my installation?
> 
> Thanks,
> 
> Dan
> 
> 
>> On Jul 7, 2016, at 6:01 PM, Leonardo Lazzaro <llazz...@dc.uba.ar> wrote:
>> 
>> Hello,
>> 
>> try to use the options DPYTHON_INCLUDE_DIR, DCMAKE_INSTALL_PREFIX.
>> for example for anaconda2 I used the following command:
>> 
>> cmake .. -DPYTHON_BINDINGS=ON -DRUN_SWIG=ON 
>> -DCMAKE_INSTALL_PREFIX=~/anaconda2 
>> -DPYTHON_INCLUDE_DIR=~/anaconda2/include/python2.7 
>> -DCMAKE_LIBRARY_PATH=~/anaconda2/lib 
>> -DSWIG_DIR=~/anaconda2/share/swig/3.0.2/ 
>> -DSWIG_EXECUTABLE=~/anaconda2/bin/swig 
>> -DPYTHON_LIBRARY=~/anaconda2/lib/libpython2.7.so 
>> -DCMAKE_BUILD_TYPE=DEBUG
>> 
>> hope it helps,
>> Leonardo
>> 
>>> On 2016-07-07 17:23, Dan Smith wrote:
>>> Hello,
>>> 
>>> I am using openbabel on a Mac - El Capitan OS X 10.11.5 operating
>>> system.
>>> 
>>> I have installed eigen2. I have python version 2.7.10.
>>> 
>>> I have successfully compiled version 2.3.90 using the following
>>> commands in terminal.
>>> 
>>> cmake ../openbabel -DPYTHON_BINDINGS=ON -DRUN_SWIG=ON
>>> make
>>> sudo make install
>>> export PYTHONPATH=/usr/local/lib:$PYTHONPATH
>>> 
>>> When I attempt to import pybel or openbabel in Python I get the
>>> following messages.
>>> 
>>>>>> import pybel
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> ImportError: No module named pybel
>>> 
>>>>>> import openbabel
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> ImportError: No module named openbabel
>>> 
>>> I have tried to search previous posts but have not found an answer
>>> that will solve my problem. At this point I’m not sure what to do to
>>> diagnose the problem.
>>> 
>>> Any help in solving my problem would be appreciated.
>>> 
>>> Thanks,
>>> 
>>> Dan
>>> ------------------------------------------------------------------------------
>>> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
>>> Francisco, CA to explore cutting-edge tech and listen to tech 
>>> luminaries
>>> present their vision of the future. This family event has something for
>>> everyone, including kids. Get more information and register today.
>>> http://sdm.link/attshape
>>> _______________________________________________
>>> OpenBabel-discuss mailing list
>>> OpenBabel-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>> 
>> ------------------------------------------------------------------------------
>> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
>> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
>> present their vision of the future. This family event has something for
>> everyone, including kids. Get more information and register today.
>> http://sdm.link/attshape
>> _______________________________________________
>> OpenBabel-discuss mailing list
>> OpenBabel-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
> 
> ------------------------------------------------------------------------------
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to