Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#110 deprecation warning (sets module) on import in python 2.6

open
nobody
None
5
2008-11-19
2008-11-19
vbr
No

I think, must have been noted before, but I didn't find any tracker entry for it.
Python 2.6 throws a warning by import of py2exe 0.6.9 due to the sets module:

Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import py2exe
C:\Python26\lib\site-packages\py2exe\build_exe.py:16: DeprecationWarning: the se
ts module is deprecated
import sets
>>>

As such, it wouldn't matter much, but in connection with a warning-bug in Idle
http://bugs.python.org/issue3926
it is not currently usable there, as the import doesn't succeed.

regards
Vlastimil Brom

Discussion

  • Here's a patch that addresses the issue. Thus uses the same technique used in mf.py. I don't seem to have the ability to upload files, so I'll include it inline as well as here: http://paste.turbogears.org/paste/85301.

    Index: py2exe/py2exe/build_exe.py

    --- py2exe/py2exe/build_exe.py (revision 686)
    +++ py2exe/py2exe/build_exe.py (working copy)
    @@ -13,7 +13,12 @@
    import sys, os, imp, types, stat
    import marshal
    import zipfile
    -import sets
    +try:
    + set
    + frozenset
    +except NameError:
    + from sets import Set as set
    + from sets import ImmutableSet as frozenset
    import tempfile
    import struct
    import re
    @@ -660,7 +665,7 @@

    # make sure all targets use the same directory, this is
    # also the directory where the pythonXX.dll must reside
    - paths = sets.Set()
    + paths = set()
    for target in dist.com_server + dist.service \ + dist.windows + dist.console + dist.isapi:
    paths.add(os.path.dirname(target.get_dest_base()))
    @@ -1032,7 +1037,7 @@
    # so the loadpath must be extended by our python path.
    loadpath = loadpath + ';' + ';'.join(pypath)

    - templates = sets.Set()
    + templates = set()
    if self.distribution.console:
    templates.add(self.get_console_template())
    if self.distribution.windows: