Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial fails if PDF filename contains non-ascii characters #37

Open
flavioamieiro opened this issue Jul 7, 2014 · 0 comments
Open

Comments

@flavioamieiro
Copy link
Member

This was added as NAMD/pypln.web#93 but it really belongs to this repository. Bellow is the original text.

Sending Cancré et al._2000.pdf...

UnicodeDecodeError Traceback (most recent call last)
in ()
4 files={'blob':fp}
5 resp = requests.post('http://demo.pypln.org/documents/', data=data,
----> 6 files=files, auth=credentials)
7 print(resp.status_code)
8

/usr/local/lib/python2.7/dist-packages/requests/api.pyc in post(url, data, **kwargs)
86 """
87
---> 88 return request('post', url, data=data, **kwargs)
89
90

/usr/local/lib/python2.7/dist-packages/requests/api.pyc in request(method, url, **kwargs)
42
43 session = sessions.Session()
---> 44 return session.request(method=method, url=url, **kwargs)
45
46

/usr/local/lib/python2.7/dist-packages/requests/sessions.pyc in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert)
322
323 # Prepare the Request.
--> 324 prep = req.prepare()
325
326 # Send the request.

/usr/local/lib/python2.7/dist-packages/requests/models.pyc in prepare(self)
223 p.prepare_headers(self.headers)
224 p.prepare_cookies(self.cookies)
--> 225 p.prepare_body(self.data, self.files)
226 p.prepare_auth(self.auth, self.url)
227 # Note that prepare_auth must be last to enable authentication schemes

/usr/local/lib/python2.7/dist-packages/requests/models.pyc in prepare_body(self, data, files)
383 # Multi-part file uploads.
384 if files:
--> 385 (body, content_type) = self._encode_files(files, data)
386 else:
387 if data:

/usr/local/lib/python2.7/dist-packages/requests/models.pyc in _encode_files(files, data)
131 new_fields.append((k, new_v))
132
--> 133 body, content_type = encode_multipart_formdata(new_fields)
134
135 return body, content_type

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/filepost.pyc in encode_multipart_formdata(fields, boundary)
73 content_type = get_content_type(filename)
74 writer(body).write('Content-Disposition: form-data; name="%s"; '
---> 75 'filename="%s"\r\n' % (fieldname, filename))
76 body.write(b('Content-Type: %s\r\n\r\n' %
77 (content_type,)))

/usr/lib/python2.7/codecs.pyc in write(self, object)
349 """ Writes the object's contents encoded to self.stream.
350 """
--> 351 data, consumed = self.encode(object, self.errors)
352 self.stream.write(data)
353

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 60: ordinal not in range(128)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant