Skip to content

Instantly share code, notes, and snippets.

@wugh
Created October 8, 2013 14:27
Show Gist options
  • Save wugh/6885563 to your computer and use it in GitHub Desktop.
Save wugh/6885563 to your computer and use it in GitHub Desktop.
tom@nextzone ~/Projects/pcsclient $ python client.py ~/Downloads/2013国庆环青海湖.zip
Namespace(file='/home/tom/Downloads/2013\xe5\x9b\xbd\xe5\xba\x86\xe7\x8e\xaf\xe9\x9d\x92\xe6\xb5\xb7\xe6\xb9\x96.zip', token='token/access_token.txt')
Traceback (most recent call last):
File "client.py", line 26, in <module>
pcs.upload('/apps/gentoo/' + os.path.basename(args.file), f)
File "/home/tom/.local/lib64/python2.7/site-packages/baidupcs/api.py", line 130, in upload
files=files, **kwargs)
File "/home/tom/.local/lib64/python2.7/site-packages/baidupcs/api.py", line 26, in wrapper
response = func(*args, **kwargs)
File "/home/tom/.local/lib64/python2.7/site-packages/baidupcs/api.py", line 62, in _request
response = requests.post(api, files=files, **kwargs)
File "/home/tom/.local/lib64/python2.7/site-packages/requests/api.py", line 88, in post
return request('post', url, data=data, **kwargs)
File "/home/tom/.local/lib64/python2.7/site-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
File "/home/tom/.local/lib64/python2.7/site-packages/requests/sessions.py", line 324, in request
prep = req.prepare()
File "/home/tom/.local/lib64/python2.7/site-packages/requests/models.py", line 225, in prepare
p.prepare_body(self.data, self.files)
File "/home/tom/.local/lib64/python2.7/site-packages/requests/models.py", line 385, in prepare_body
(body, content_type) = self._encode_files(files, data)
File "/home/tom/.local/lib64/python2.7/site-packages/requests/models.py", line 133, in _encode_files
body, content_type = encode_multipart_formdata(new_fields)
File "/home/tom/.local/lib64/python2.7/site-packages/requests/packages/urllib3/filepost.py", line 75, in encode_multipart_formdata
'filename="%s"\r\n' % (fieldname, filename))
File "/usr/lib64/python2.7/codecs.py", line 351, in write
data, consumed = self.encode(object, self.errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 59: ordinal not in range(128)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment