By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

supressing warning message?

P: n/a
Due to some uninteresting configuration management issues, I'm
running a mismatched python library and getting this message
dumped to stderr.
/.../lib/site-python/Sybase/Sybase.py:20:
RuntimeWarning: Python C API version mismatch for module sybasect:
This Python has API version 1011, module sybasect has version 1012.


While I'm straightening the the CM, everything seems to work well, except
for the warning being printed. Is there a way to intercept or
supress this?

Many TIA!
Mark

--
Mark Harrison
Pixar Animation Studios
Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
While I haven't tested this to be sure, "RuntimeWarning" suggests that
this message is coming from the regular warnings machinery. Routines in
the "warnings" module let you silence these warnings.

http://docs.python.org/lib/module-warnings.html

Here's a brute-force way to silence all warnings:
import warnings; warnings.filterwarnings('ignore')
you might want to use something a little more targeted.

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBCFT1Jd01MZaTXX0RAsFwAKCjrtYu/dW2terK5youEgfMBYLFdwCgjNOK
+f4IbOWEv/LRChWqT2DbqpA=
=uYPK
-----END PGP SIGNATURE-----

Jul 18 '05 #2

P: n/a
Jeff Epler wrote:
Here's a brute-force way to silence all warnings:
import warnings; warnings.filterwarnings('ignore')
you might want to use something a little more targeted.


Now I'm doing this, and it works perfectly:

warnings.filterwarnings('ignore')
import Sybase
warnings.filterwarnings('always')

Thanks!
Mark
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.