Pybel attribute error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Pybel attribute error

Kohsei Tsuji
This post has NOT been accepted by the mailing list yet.
Dear all,

I am using openbabel 2.4.1 (with python building) on OS X Yosemite 10.10.5 and python 2.7.10.
I have successfully installed openbabel using homebrew, and checked pybel module was correctly imported in python without any error.
Then, I tried to run the following python script (sample.py) to test pybel module properly works.

import pybel
mol = pybel.OBMol()
conv = pybel.OBConversion()
conv.SetInAndOutFormats("smi","mdl")
conv.ReadString(mol,"c1ccccc1O")
print mol.NumAtoms()
mol.AddHydrogens()
print mol.NumAtoms()
conv.WriteFile(mol,'phenol.mol')

but when I tried to run this script I got the attribute error as follows.

Traceback (most recent call last):
  File "/Users/kohseitsuji/Desktop/sample.py", line 2, in <module>
    mol = pybel.OBMol()
AttributeError: 'module' object has no attribute 'OBMol'

I’m not sure why this error happens since I could import the pybel module in python.

How can I fix this error?  Any help would be highly appreciated.

Thank you
Loading...