You are welcome! I used OpenBabel extensively in CGIs and embedded in a database, and had no problems. You just have to specify the right logging level (off).
Craig On Sat, Aug 29, 2020 at 10:16 AM Wang, Jiyao (NIH/NLM/NCBI) [E] < wang...@ncbi.nlm.nih.gov> wrote: > Thanks a lot, Craig! I will tri it out. > > > > Before I included openbabel library in the makefile, my cgi works. Once I > included openbabel in my makefile, the cgi has 500 error. I didn’t even add > my program using openbabel yet. So I may need to modify the openbabel > library. > > > > Thanks! > > > > Jiyao > > > > *From:* Craig James <cja...@emolecules.com> > *Sent:* Saturday, August 29, 2020 1:01 PM > *To:* Wang, Jiyao (NIH/NLM/NCBI) [E] <wang...@ncbi.nlm.nih.gov> > *Cc:* openbabel-discuss@lists.sourceforge.net > *Subject:* Re: [Open Babel] How to disable output stream in openbabel > library? > > > > Try: > > > > obErrorLog.StopLogging(); > > > > And/or you may need to use SetOutputLevel() > <http://openbabel.org/dev-api/classOpenBabel_1_1OBMessageHandler.shtml#ae467fbd6fca625ae5ee0ea066810280f> > . > > > > Craig > > > > On Sat, Aug 29, 2020 at 9:23 AM Wang, Jiyao (NIH/NLM/NCBI) [E] via > OpenBabel-discuss <openbabel-discuss@lists.sourceforge.net> wrote: > > Hi, > > > > I need to use openbabel to add hydrogens for ligands in PDB structures. > The executable program works. But when I included the code as part of the > C++ cgi, it has the error 500 because the output stream messed up with the > output stream in cgi. I tried to comment out cout, printf, etc and it still > didn’t work. Any suggestions? > > > > The compile alone caused the problem. I added the following to compile > with openbabel library: > > ========= > > CPPFLAGS = … \ > > -I /mypath/openbabel-openbabel-3-1-1/include/openbabel3 > > > > LDFLAGS= -lopenbabel -L /mypath/delphi/openbabel-openbabel-3-1-1/lib > > ========= > > > > Here is my small program: > > ========= > > #include <iostream> > > #include <fstream> > > > > using namespace std; > > using namespace OpenBabel; > > > > string addHydrogen(string& pdbStr) > > { > > string pdbHStr = ""; > > > > cout.rdbuf(NULL); > > cerr.rdbuf(NULL); > > clog.rdbuf(NULL); > > > > OBConversion conv; > > conv.SetInFormat("pdb"); > > conv.SetOutFormat("pdb"); > > > > OBMol mol; > > //conv.ReadFile(&mol,filepath); > > conv.ReadString(&mol,pdbStr); > > > > mol.AddHydrogens(); > > > > //string filepath2 = "./test.pdbH"; > > //conv.WriteFile(&mol,filepath2.c_str()); > > bool trimWhitespace = true; > > pdbHStr = conv.WriteString(&mol, trimWhitespace); > > > > return pdbHStr; > > } > > ========= > > > > Thanks! > > > > Jiyao Wang > > > > > > _______________________________________________ > OpenBabel-discuss mailing list > OpenBabel-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > > > > > -- > > --------------------------------- > Craig A. James > > Chief Technology Officer > > eMolecules, Inc. > > 3430 Carmel Mountain Road, Suite 250 > > San Diego, CA 92121 > > --------------------------------- > -- --------------------------------- Craig A. James Chief Technology Officer eMolecules, Inc. 3430 Carmel Mountain Road, Suite 250 San Diego, CA 92121 ---------------------------------
_______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss