On 4 December 2012 09:16, mpillong <max.pill...@pharma.ethz.ch> wrote:
> Hmmm, sorry about that, I was using the < raw > Tag here ... but here's the
> original text.
>
> Hey everyone,
>
> I am currently running OpenBabel on a MacOSX 10.6.8 in Eclipse with Java.
> Recently, I encountered the following exception during using the WriteFile()
> Method in OBConversion:
>
> 'Invalid memory access of location 0xfffffffb25991558 rip=0x7fff888cb683'
>
>
> I have used the same method to write molecules before, the code looks like
> this:
>
> public static void writeOBMolecule(OBMol mol, String output, String format){
>         OBConversion obc=new OBConversion();
>         obc.SetInAndOutFormats(format, format);
>         obc.WriteFile(mol, output);
> }

You have forgotten to check the return value of SetInAndOutFormats and
also to close the output file (not a problem unless you write to it a
second time). Actually here you should just use SetOutFormat as
follows:

bool success = obc.SetOutFormat(format);
if (success) {
   obc.WriteFile(mol, output)
   obc.CloseOutFile()
   }
else
   {//handle exception}

>
> I have tried multiple *.pdb files, the same error occurs every time
> (although the location does change every time). Any thoughts on this?
>
> Thanks in advance!
>
> Max
>
>
>
> --
> View this message in context: 
> http://forums.openbabel.org/Invalid-memory-access-during-OBConversion-WriteFile-tp4655729p4655731.html
> Sent from the General discussion mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to