Hey Geoff-
Thanks for the response. I did file a bug here:
https://github.com/openbabel/openbabel/issues/1690
I'm with you on the cdxml, and it does work seamlessly. Then of course, I'm in
the position of having to convert a bunch of .cdx files to .cdxml files.
FWIW, I did convert the .cdx file to a .txt file and view it in WordPad
(attached). The only thing that identifies/matches the error as "No ChemDraw
Header" is in the first line where "ChemDraw 16.0.0.82" is written. Bearing in
mind that I'm well out of my depth here, is it possible that there's a wrong
string match somewhere in the Pybel code (ie maybe a space (eg Chem_Draw or
Chem Draw) or something like that) that's causing a problem?
Also, I will note that referencing the original PyBel paper, I used the
following code in the Jupyter notebook to try and convert the file and get the
same error message (Invalid File. No ChemDraw Header).
import openbabel
allmols3 = []
obconversion = openbabel.OBConversion()
obconversion.SetInFormat("cdx")
obmol = openbabel.OBMol()
notatend = obconversion.ReadFile(obmol, "genericStructures.cdx")
while notatend:
allmols3.append(obmol)
obmol = openbabel.OBMol()
notatend = obconversion.Read(obmol)
It seems that it's not just a Jupyter Notebook problem. I recreated the above
script in Spyder and ran from there. I've included the error message I
received on output. The exception thrown is "ImportError: DLL load failed:
%1 is not a valid Win32 application." I don't know what that means (I'm kind
of new at this), but am not sure whether or not it will help. This might also
be a problem on my end, as the same script gave the same error for trying to
convert a .smi file, which has worked in the past.
Thanks again, all.
Stan
Stanley (Stan) P. Kolis
Research Advisor, Small Molecule Design & Development
Eli Lilly and Company
Lilly Corporate Center, Indianapolis IN 46285 U.S.A.
+1 317.433.3982 (office) | +1 317.494.2583 (mobile)
sko...@lilly.com<mailto:sko...@lilly.com> | www.lilly.com<http://www.lilly.com/>
[LillyLogo_EmailSig2.jpg]
CONFIDENTIALITY NOTICE: This email message (including all attachments) is for
the sole use of the intended recipient(s) and may contain confidential
information. Any unauthorized review, use, disclosure, copying or distribution
is strictly prohibited. If you are not the intended recipient, please contact
the sender by reply email and destroy all copies of the original message.
From: Geoffrey Hutchison [mailto:geoff.hutchi...@gmail.com]
Sent: Wednesday, November 15, 2017 5:14 PM
To: Stanley P Kolis <kolis_stan...@lilly.com>
Cc: Pascal Muller <pascal.jm.mul...@gmail.com>; babel
<openbabel-discuss@lists.sourceforge.net>
Subject: [EXTERNAL] Re: [Open Babel] Problem Converting .cdx files using Pybel
I have attached a new ChemDraw file with some generic structures in it. This
raises the same error I have seen with the other files. I have also included a
screenshot of the OpenBabel GUI conversion of the same .cdx file.
I have seen this before (e.g., inside of Avogadro or other programs) but have
not figured out what's different inside a Python script vs. the Open Babel
binaries themselves as far as the binary format reading.
As Noel, mentioned, please file a bug and we'll see what I can do.
One suggestion (albeit not a great one) is to use CDXML, which should read just
fine.
-Geoff
runfile('C:/Users/rc93356/AnacondaProjects/OpenBabelStuff/openBabel_SpyderScript.py',
wdir='C:/Users/rc93356/AnacondaProjects/OpenBabelStuff')
Traceback (most recent call last):
File "<ipython-input-3-287f949219b0>", line 1, in <module>
runfile('C:/Users/rc93356/AnacondaProjects/OpenBabelStuff/openBabel_SpyderScript.py',
wdir='C:/Users/rc93356/AnacondaProjects/OpenBabelStuff')
File
"C:\Users\rc93356\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py",
line 866, in runfile
execfile(filename, namespace)
File
"C:\Users\rc93356\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py",
line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File
"C:/Users/rc93356/AnacondaProjects/OpenBabelStuff/openBabel_SpyderScript.py",
line 8, in <module>
import openbabel
File
"C:\Users\rc93356\AppData\Local\Continuum\Anaconda3\lib\site-packages\openbabel.py",
line 30, in <module>
_openbabel = swig_import_helper()
File
"C:\Users\rc93356\AppData\Local\Continuum\Anaconda3\lib\site-packages\openbabel.py",
line 26, in swig_import_helper
_mod = imp.load_module('_openbabel', fp, pathname, description)
File "C:\Users\rc93356\AppData\Local\Continuum\Anaconda3\lib\imp.py", line
242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\rc93356\AppData\Local\Continuum\Anaconda3\lib\imp.py", line
342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: %1 is not a valid Win32 application.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss