Skip to content

Commit 4f36baf

Browse files
committed
Fix unicode in photo filepath
1 parent 83d73b6 commit 4f36baf

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

vk_api/vk_upload.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,17 @@ def document(self, file_path, title=None, tags=None, group_id=None):
149149

150150

151151
def open_photos(photos_paths):
152-
photos = {}
152+
photos = []
153153

154154
for x, filename in enumerate(photos_paths):
155-
photos['file%s' % x] = open(filename, 'rb')
155+
filetype = filename.split('.')[-1]
156+
photos.append(
157+
('file%s' % x, ('pic.' + filetype, open(filename, 'rb')))
158+
)
156159

157160
return photos
158161

159162

160163
def close_photos(photos):
161-
for i in photos:
162-
photos[i].close()
164+
for photo in photos:
165+
photo[1][1].close()

0 commit comments

Comments
 (0)