Skip to content

Fix /bytes endpoint with newer werkzeug versions - #41

Merged
sigmavirus24 merged 1 commit into
psf:mainfrom
swt2c:fix_bytes_route
Mar 22, 2024
Merged

sigmavirus24 merged 1 commit into
psf:mainfrom
swt2c:fix_bytes_route

Conversation

@swt2c

@swt2c swt2c commented Jan 10, 2024

Copy link
Copy Markdown

At some point, werkzeug starting checking the inputs to the write() method, which caused the following traceback:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 364, in run_wsgi
execute(self.server.app)
File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 328, in execute
write(data)
File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 296, in write
assert isinstance(data, bytes), "applications must write bytes"
AssertionError: applications must write bytes

Fix this by using bytes instead of bytearray.

At some point, werkzeug starting checking the inputs to the write()
method, which caused the following traceback:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 364, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 328, in execute
    write(data)
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 296, in write
    assert isinstance(data, bytes), "applications must write bytes"
AssertionError: applications must write bytes

Fix this by using bytes instead of bytearray.
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

Successfully merging this pull request may close these issues.

2 participants