From 83de14ffea88eb78b99d76a0cd784b0e036958a4 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 31 Aug 2016 00:35:58 +0200 Subject: [PATCH] more py3 support --- pandora_client/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index 4293af6..cad8a3c 100755 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -552,19 +552,19 @@ class Client(object): example = example_path(self) print('Files need to be in a folder structure like this:\n%s\n' % example) print('The following files do not fit into the folder structure and will not be synced:') - print('\t' + '\n\t'.join([f[len(path):].encode('utf-8') for f in unknown])) + print('\t' + '\n\t'.join([f[len(path):] for f in unknown])) print('') if unsupported: files = sorted(set(files) - set(unsupported)) print('The following files are in an unsupported format and will not be synced:') - print('\t' + '\n\t'.join([f[len(path):].encode('utf-8') for f in unsupported])) + print('\t' + '\n\t'.join([f[len(path):] for f in unsupported])) print('') ''' ''' - deleted_files = filter(lambda f: f not in files, known_files) - new_files = filter(lambda f: f not in known_files, files) + deleted_files = list(filter(lambda f: f not in files, known_files)) + new_files = list(filter(lambda f: f not in known_files, files)) conn, c = self._conn() if deleted_files: deleted = time.mktime(time.localtime()) @@ -1013,7 +1013,7 @@ class API(ox.API): if os.path.exists(i['media']): size = ox.format_bytes(os.path.getsize(i['media'])) name = os.path.basename(filename) - print((u"uploading %s of %s (%s)" % (profile, name, size)).encode('utf-8')) + print(u"uploading %s of %s (%s)" % (profile, name, size)) url = self.url + 'upload/?profile=%s&id=%s' % (profile, i['oshash']) if not self.upload_chunks(url, i['media'], data): if DEBUG: @@ -1063,7 +1063,7 @@ class API(ox.API): if uploadUrl.startswith('/'): u = urlparse(url) uploadUrl = '%s://%s%s' % (u.scheme, u.netloc, uploadUrl) - f = open(filename) + f = open(filename, 'rb') fsize = os.stat(filename).st_size done = 0 start = time.mktime(time.localtime())