thriftpy icon indicating copy to clipboard operation
thriftpy copied to clipboard

Fixes #302 -- deprecation warnings when array.tostring() is called on Python 3.3+

Open terwilliger42 opened this issue 7 years ago • 4 comments

Fixes #302; calls appropriate array.tobytes / array.tostring depending on Python version.

terwilliger42 avatar Jun 29 '17 22:06 terwilliger42

Not sure why this fails Travis for Python 2.6, but don't think it has anything to do with my change.

terwilliger42 avatar Jun 29 '17 22:06 terwilliger42

Would be awesome if someone merged it. My logs are rather unreadable because of tons of deprecation warnings. :/

michcio1234 avatar Aug 25 '17 07:08 michcio1234

@michcio1234 FYI: You can use Python's 'warnings' module to suppress these messages. Here's what we've done in the interim. This disables this specific warning only within the context manager.

import warnings

with warnings.catch_warnings():
    # Filter out Thriftpy deprecation warnings
    warnings.filterwarnings(action='ignore', message=r'tostring\(\) is deprecated. Use tobytes\(\) instead.', module='thriftpy.protocol.compact',
                            category=DeprecationWarning)
    <thrift code here>

terwilliger42 avatar Aug 25 '17 16:08 terwilliger42

Thriftpy was not supported any more, and it already be resolved in thriftpy2, thanks!

ethe avatar Sep 26 '18 15:09 ethe