Fix issues with python3
The introduced way of printing things in python3 would work for byte arrays but not for simple strings. This patch fixes this issue. Signed-off-by: Lars Kiesow <lkiesow@uos.de>
This commit is contained in:
parent
a787b22b7f
commit
d6cbfdb81c
2 changed files with 6 additions and 7 deletions
|
@ -11,13 +11,11 @@
|
|||
from feedgen.feed import FeedGenerator
|
||||
import sys
|
||||
|
||||
def print_enc(string):
|
||||
version = sys.version_info[0]
|
||||
|
||||
if version == 2:
|
||||
print(string)
|
||||
elif version == 3:
|
||||
sys.stdout.buffer.write(string)
|
||||
def print_enc(s):
|
||||
'''Print function compatible with both python2 and python3 accepting strings
|
||||
and byte arrays.
|
||||
'''
|
||||
print(s.decode('utf-8') if type(s) == type(b'') else s)
|
||||
|
||||
|
||||
|
||||
|
|
1
setup.py
1
setup.py
|
@ -27,6 +27,7 @@ setup(
|
|||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Topic :: Communications',
|
||||
'Topic :: Internet',
|
||||
'Topic :: Text Processing',
|
||||
|
|
Loading…
Reference in a new issue