Comments (1)
FYI: I ran into this issue as well, and was able to work around it by bypassing the subclass's Response.write
method and called directly into the base class's write
method.
The error happens here:
https://github.com/GoogleCloudPlatform/webapp2/blob/master/webapp2.py#L420
It occurs when trying to pass bytes
content (e.g. a binary asset like a JPG file) as the text
parameter.
I worked around it by replacing the self.response.out.write(...)
code in my handler with the following, where I bypass the subclass's write
method and just call into the webob.Response.write
directly.
fp = open(path, 'rb') # Path is the path to the binary file I'm trying to send.
super(webapp2.Response, self.response).write(fp.read())
FYI: This seems to work for me, but I'm not sure if there are any side effects that may crop up from this approach.
from webapp2.
Related Issues (20)
- Any roadmap on this framework? HOT 1
- ipdb support for webapp2 HOT 8
- Old webob library in 2.5.2 HOT 7
- Documentation update : New note in route guide - regex groups HOT 3
- ProtoRPC support?
- Cookie reuse question
- webapp incorrectly passes non-utf8 charset header to webob
- include of other PY file does not work HOT 1
- Document webapp2_extras/xsrf.py HOT 3
- Docs for webapp2.Router.__init__() and add() misleading HOT 1
- Update webapp2 auth for standard GAE Python3 HOT 11
- Get Request Fails in Firefox, but not Edge, Chrome, Opera HOT 2
- Build-job "lint" fails with newer version of flake8-import-order HOT 2
- Build-job "tests_gaesdk" fails in webapp1 tests HOT 2
- ETA on 3.0.0? HOT 1
- i18n modules do not merge HOT 1
- About Upgrade from Python 2 to 3 HOT 10
- Handle UnicodeDecodeError on bad UTF-8 URLs HOT 1
- Add support for new version of webob that has support to SameSite cookie flag
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webapp2.