"Deprecated sets module" with Python 2.6
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Tue Jul 28 18:49:00 EDT 2009
On Tue, 28 Jul 2009 22:28:09 +0200, Virgil Stokes wrote:
> When using GUI2exe to create an *.exe I always get the following warning
> during the compile process:
>
> C:\Python26\lib\site-packages\py2exe\build_exe.py:16:
> DeprecationWarning: the sets module is deprecated
> import sets
The best solution would be to change every call to sets.Set() to set(),
and change the line:
import sets
to this:
try:
set
except NameError:
from sets import Set as set
If you use sets.ImmutableSet, you will need to change that to frozenset
in the same way.
This assumes you don't need to support older versions of Python, before
set() became a built-in.
--
Steven
More information about the Python-list
mailing list