Hi Noel,
Sorry for the slow response, I've been quite busy. I had some trouble
compiling the latest code from Git due to errors like this:
/home/leeping/src/openbabel/scripts/python/openbabel-python.cpp: In function
‘PyObject* _wrap_OBReaction_AddReactant(PyObject*, PyObject*)’:
/home/leeping/src/openbabel/scripts/python/openbabel-python.cpp:24798:81:
error: ‘shared_ptr’ was not declared in this scope
/home/leeping/src/openbabel/scripts/python/openbabel-python.cpp:24798:81: note:
suggested alternative:
/usr/include/c++/4.6/tr1/shared_ptr.h:510:11: note: ‘std::tr1::shared_ptr’
Changing the SWIG-generated code to the following worked for me, though I am
not sure if it's a general solution, and I haven't used the object yet (though
I will soon).
https://dl.dropboxusercontent.com/u/5381783/openbabel-python.cpp
Thanks,
- Lee-Ping
On Aug 23, 2013, at 3:26 PM, Noel O'Boyle wrote:
> Looks like a SWIG wrapping issue.
>
> If you are compiling the bindings yourself, adding:
> %include <std_shared_ptr.i>
> ...close to the start of the openbabel-python.i file might simply sort
> out the problem. I'll take a look asap.
>
> - Noel
>
> On 20 August 2013 19:13, Lee-Ping Wang <leep...@stanford.edu> wrote:
>> Hi there,
>>
>> I'm using OpenBabel in a Python script, and I created several OBMol
>> objects that I would like to organize into an OBReaction object.
>> However, I am getting the following TypeError:
>>
>> obm = ob.OBMol()
>> obcsvg = ob.OBConversion()
>> obcsvg.SetInAndOutFormats("xyz","svg")
>> obcsvg.ReadFile(obm, sys.argv[1])
>> obr = ob.OBReaction()
>> obr.AddReactant(obm)
>>
>> Traceback (most recent call last):
>> File "./xyzob.py", line 23, in <module>
>> obr.AddReactant(obm)
>> TypeError: in method 'OBReaction_AddReactant', argument 2 of type
>> 'shared_ptr< OpenBabel::OBMol > const'
>>
>> It seems the AddReactant() method is expecting a shared_ptr, or
>> something else that Python cannot provide. Am I doing something wrong,
>> or should the wrapping be improved?
>>
>> Thanks,
>>
>> - Lee-Ping
>>
>> ------------------------------------------------------------------------------
>> Introducing Performance Central, a new site from SourceForge and
>> AppDynamics. Performance Central is your source for news, insights,
>> analysis and resources for efficient Application Performance Management.
>> Visit us today!
>> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
>> _______________________________________________
>> OpenBabel-discuss mailing list
>> OpenBabel-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss