Suppressing DeprecationWarning

96 views
Skip to first unread message

Marcin Krol

unread,
Feb 5, 2010, 9:10:36 AM2/5/10
to pyins...@googlegroups.com
Hello,

I have successfully packaged an application that uses paramiko (which
imports Crypto), thanks for Pyinstaller!

However, there's a slight problem: Crypto uses some libraries that
display deprecation warning. It is easy to suppress those warnings in
the .py file:

#!/usr/bin/python2.4 -W ignore::DeprecationWarning

However, the binary while executing now displays:

cssh/build/pyi.linux2/cssh/outPYZ1.pyz/Crypto.Util.randpool:40:
RandomPool_DeprecationWarning: This application uses RandomPool, which
is BROKEN in older releases. See http://www.pycrypto.org/randpool-broken

Is there some way of suppressing this?

Regards,
mk

Giovanni Bajo

unread,
Feb 5, 2010, 9:19:31 AM2/5/10
to pyins...@googlegroups.com

The fastest way is to disable the warning at runtime, by importing and
using the "warning" standard module. This will work with and without
PyInstaller.

FYI, the equivalent of using command-line arguments would be to use the
OPTION element in the TOC:
http://www.pyinstaller.org/export/latest/trunk/doc/Manual.html?format=raw#toc-class-table-of-contents

You could try adding something like ('W', 'ignore::DeprecationWarning',
'OPTION') to the TOC within your Makespec. The code that handles this
at bootstrap is in source/common/launch.c, around line 570. I'm not even
sure it is currently compiled in (there's an #ifdef which should
probably be removed).

--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com


Marcin Krol

unread,
Feb 5, 2010, 11:21:12 AM2/5/10
to pyins...@googlegroups.com
Giovanni Bajo wrote:
> On Fri, 2010-02-05 at 15:10 +0100, Marcin Krol wrote:
>> Hello,
>>
>> I have successfully packaged an application that uses paramiko (which
>> imports Crypto), thanks for Pyinstaller!
>>
>> However, there's a slight problem: Crypto uses some libraries that
>> display deprecation warning. It is easy to suppress those warnings in
>> the .py file:
>>
>> #!/usr/bin/python2.4 -W ignore::DeprecationWarning
>>
>> However, the binary while executing now displays:
>>
>> cssh/build/pyi.linux2/cssh/outPYZ1.pyz/Crypto.Util.randpool:40:
>> RandomPool_DeprecationWarning: This application uses RandomPool, which
>> is BROKEN in older releases. See http://www.pycrypto.org/randpool-broken
>>
>> Is there some way of suppressing this?
>
> The fastest way is to disable the warning at runtime, by importing and
> using the "warning" standard module. This will work with and without
> PyInstaller.

Thanks this worked!

Reply all
Reply to author
Forward
0 new messages