Re: [Rdkit-discuss] Ridiculously easy problem - capture RDKit's error messages

2015-01-23 Thread JP
yo Folks, You cannot use exception handling for this - as the molecule-input methods do not throw exceptions. You can see this with: #!/usr/bin/env python import rdkit from rdkit import Chem try: print 1 Chem.MolFromSmiles('XXX') print 2 except Exception as msg: print 3 prin

Re: [Rdkit-discuss] Ridiculously easy problem - capture RDKit's error messages

2015-01-23 Thread Greg Landrum
Hi JP, Unfortunately this is a gap in the RDKit's logging functionality. There's really no way to do this at the moment without starting your python job in another process and capturing its output to stderr. There is a "todo" item to switch to using a better logging solution in the c++ backend, b

Re: [Rdkit-discuss] Ridiculously easy problem - capture RDKit's error messages

2015-01-23 Thread Abhik Seal
Hi JP, I think you can use try and catch , try: throws() return 0 except Exception, err: sys.stderr.write('ERROR: %s\n' % str(err)) return 1 Hope this helps. Abhik Seal Indiana University Bloomington School of Informatics and Computing Cheminformatics an

Re: [Rdkit-discuss] Ridiculously easy problem - capture RDKit's error messages

2015-01-23 Thread Adrian JasiƄski
see: https://docs.python.org/2/tutorial/errors.html import rdkit from rdkit import Chem try: Chem.MolFromSmiles('XXX') except Exception as msg: (do something here e.g. pring msg) pozdrawiam Adrian 2015-01-23 14:58 GMT+01:00 JP : > > Yo RDKitters, > > I am stuck on something so basic, it

[Rdkit-discuss] Ridiculously easy problem - capture RDKit's error messages

2015-01-23 Thread JP
Yo RDKitters, I am stuck on something so basic, its embarrassing. But for the life of me I cannot figure it out on my own. This is probably more of a python question than an RDKit one. I want to capture the RDKit warning/error message from python. e.g. >>> import rdkit >>> from rdkit import C