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
|
from feedgen.feed import FeedGenerator
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
def print_enc(string):
|
def print_enc(s):
|
||||||
version = sys.version_info[0]
|
'''Print function compatible with both python2 and python3 accepting strings
|
||||||
|
and byte arrays.
|
||||||
if version == 2:
|
'''
|
||||||
print(string)
|
print(s.decode('utf-8') if type(s) == type(b'') else s)
|
||||||
elif version == 3:
|
|
||||||
sys.stdout.buffer.write(string)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -27,6 +27,7 @@ setup(
|
||||||
'Operating System :: OS Independent',
|
'Operating System :: OS Independent',
|
||||||
'Programming Language :: Python',
|
'Programming Language :: Python',
|
||||||
'Programming Language :: Python :: 2',
|
'Programming Language :: Python :: 2',
|
||||||
|
'Programming Language :: Python :: 3',
|
||||||
'Topic :: Communications',
|
'Topic :: Communications',
|
||||||
'Topic :: Internet',
|
'Topic :: Internet',
|
||||||
'Topic :: Text Processing',
|
'Topic :: Text Processing',
|
||||||
|
|
Loading…
Reference in a new issue