I've fixed the problem. It took a bit more work than I expected. If you use the latest code in github it should work for you. Remember to recreate the bindings (-DPYTHON_BINDINGS=ON -DRUN_SWIG=ON).
The following code now works: import pybel ob = pybel.ob r = ob.OBReaction() m = ob.OBMol() r.AddReactant(m) - Noel On 26 August 2013 01:59, Lee-Ping Wang <leep...@stanford.edu> wrote: > Hi Noel, > > Thanks! I appreciate it. I will take a look tomorrow as well. > > - Lee-Ping > > On Aug 23, 2013, at 12: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 > ------------------------------------------------------------------------------ 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