Reputation: 24774
when I use MySQLdb get this message:
/var/lib/python-support/python2.6/MySQLdb/__init__.py:34: DeprecationWarning: the sets module is deprecated from sets import ImmutableSet
I try filter the warning with
import warnings
warnings.filterwarnings("ignore", message="the sets module is deprecated from sets import ImmutableSet")
but, I not get changes.
any suggestion?
Many thanks.
Upvotes: 1
Views: 1507
Reputation: 18039
From python documentation: you could filter your warning this way, so that if other warnings are caused by an other part of your code, there would still be displayed:
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
import MySQLdb
[...]
but as said by Alex Martelli, the best solution would be to update MySQLdb so that it doesn't use deprecated modules.
Upvotes: 4
Reputation: 882113
What release of MySQLdb are you using? I think the current one (1.2.3c1) should have it fixed see this bug (marked as fixed as of Oct 2008, 1.2 branch).
Upvotes: 1