diff --git a/feedgen/__main__.py b/feedgen/__main__.py index bc34a55..1ff4d0a 100644 --- a/feedgen/__main__.py +++ b/feedgen/__main__.py @@ -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) diff --git a/setup.py b/setup.py index 92ba3c2..059dcb7 100755 --- a/setup.py +++ b/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',