That's very strange. Can you add an assert statement "assert len(atoms) > 0" after atoms = mol.atoms, and verify that it still runs fine.
On 7 February 2011 18:12, zio <ziodmi...@ya.ru> wrote: > > Hi, > I'm trying to write program using Python, PySide and openbabel, but some > things are strange: in GUI-application I can't obtain Atom.atomicmass value. > > Code below gives masses about e-315 > > > #!/usr/bin/python > # -*- coding: utf-8 -*- > import sys > from PySide import QtCore > from PySide import QtGui > import pybel > > app = QtGui.QApplication(sys.argv) > window = QtGui.QMainWindow() > window.show() > > tt = 'C(CO)CS' > mol = pybel.readstring("smi",tt) > atoms = mol.atoms > for atom in atoms: > print atom.atomicmass, atom.atomicnum, atom.exactmass > mwt=mol.molwt > print tt + ' Molecular weight is: ' + str(mwt) > > sys.exit(app.exec_()) > > > Without "app" part all is OK. > (I'm using python-openbabel 2.2.3-1build1 from Ubuntu repos) > > > > -- > View this message in context: > http://forums.openbabel.org/Python-Qt-and-openbabel-atomicmass-error-tp3264710p3264710.html > Sent from the General discussion mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > The modern datacenter depends on network connectivity to access resources > and provide services. The best practices for maximizing a physical server's > connectivity to a physical network are well understood - see how these > rules translate into the virtual world? > http://p.sf.net/sfu/oracle-sfdevnlfb > _______________________________________________ > OpenBabel-discuss mailing list > OpenBabel-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss