Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > "Deprecated sets module" with Python 2.6

Reply
Thread Tools

"Deprecated sets module" with Python 2.6

 
 
Virgil Stokes
Guest
Posts: n/a
 
      07-28-2009
I would appreciate help on correcting a problem when trying to create an
*.exe file using py2exe via GUI2exe with Python 2.6.2.

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

and this results in the creation of an *.exe file that can not be executed.

On the other hand, if I use the same procedure (on the same Python code)
with
Python 2.5, there are no warnings and the *.exe works fine.

The procedure used is that given in the example "Less simpler one" at

http://code.google.com/p/gui2exe/wiki/GUI2ExeExamplesin

Any suggestions, help, ... would be greatly appreciated.

Thanks,
--V.

 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      07-28-2009
Virgil Stokes schrieb:
> I would appreciate help on correcting a problem when trying to create an
> *.exe file using py2exe via GUI2exe with Python 2.6.2.
>
> 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
>
> and this results in the creation of an *.exe file that can not be executed.
>
> On the other hand, if I use the same procedure (on the same Python code)
> with
> Python 2.5, there are no warnings and the *.exe works fine.
>
> The procedure used is that given in the example "Less simpler one" at
>
> http://code.google.com/p/gui2exe/wiki/GUI2ExeExamplesin
>
> Any suggestions, help, ... would be greatly appreciated.


If you don't need your app running on python2.3 and earlier, just remove
the sets-module and replace it with the builtin "set".

Diez
 
Reply With Quote
 
 
 
 
Steven D'Aprano
Guest
Posts: n/a
 
      07-28-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

 
Reply With Quote
 
Virgil Stokes
Guest
Posts: n/a
 
      07-29-2009
Diez B. Roggisch wrote:
> Virgil Stokes schrieb:
>> I would appreciate help on correcting a problem when trying to create
>> an *.exe file using py2exe via GUI2exe with Python 2.6.2.
>>
>> 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
>>
>> and this results in the creation of an *.exe file that can not be
>> executed.
>>
>> On the other hand, if I use the same procedure (on the same Python
>> code) with
>> Python 2.5, there are no warnings and the *.exe works fine.
>>
>> The procedure used is that given in the example "Less simpler one" at
>>
>> http://code.google.com/p/gui2exe/wiki/GUI2ExeExamplesin
>>
>> Any suggestions, help, ... would be greatly appreciated.

>
> If you don't need your app running on python2.3 and earlier, just
> remove the sets-module and replace it with the builtin "set".

Of course Diez, this is a good suggestion. However, in this case the
Python code that I am trying to convert into an *.exe file does not
refer to sets directly; i.e, the use of this module is buried within a
package that is imported (wxPython) which is not under my control.

--V
>
> Diez



 
Reply With Quote
 
Virgil Stokes
Guest
Posts: n/a
 
      07-29-2009
Virgil Stokes wrote:
> Diez B. Roggisch wrote:
>> Virgil Stokes schrieb:
>>> I would appreciate help on correcting a problem when trying to
>>> create an *.exe file using py2exe via GUI2exe with Python 2.6.2.
>>>
>>> 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
>>>
>>> and this results in the creation of an *.exe file that can not be
>>> executed.
>>>
>>> On the other hand, if I use the same procedure (on the same Python
>>> code) with
>>> Python 2.5, there are no warnings and the *.exe works fine.
>>>
>>> The procedure used is that given in the example "Less simpler one" at
>>>
>>> http://code.google.com/p/gui2exe/wiki/GUI2ExeExamplesin
>>>
>>> Any suggestions, help, ... would be greatly appreciated.

>>
>> If you don't need your app running on python2.3 and earlier, just
>> remove the sets-module and replace it with the builtin "set".

> Of course Diez, this is a good suggestion. However, in this case the
> Python code that I am trying to convert into an *.exe file does not
> refer to sets directly; i.e, the use of this module is buried within a
> package that is imported (wxPython) which is not under my control.
>
> --V
>>
>> Diez

>
>

Whoops, the reference to the module sets is in py2exe not wxPython.

--V

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: "Deprecated sets module" with Python 2.6 Gabriel Genellina Python 1 07-29-2009 10:25 AM
Ordering python sets Mr.SpOOn Python 31 11-06-2008 01:28 PM
Re: Ordering python sets Tim Chase Python 8 10-22-2008 07:52 PM
Sets in Python sapsi Python 33 09-22-2007 02:23 PM
Python sets. Grzegorz Dostatni Python 4 05-05-2004 02:07 AM



Advertisments