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 does not support pathlib #1653

manlix opened this issue Oct 17, 2019 · 0 comments · Fixed by #1654
Closed does not support pathlib #1653

manlix opened this issue Oct 17, 2019 · 0 comments · Fixed by #1654


Copy link

manlix commented Oct 17, 2019


I expected save uploaded file to pathlib object.


from pathlib import Path

# ...

def path_to_save(document_id):
    return Path(myproject.config.DocumentProcessing.save_to(document_id))

# ...


# ...

Actual Behavior

Uploaded file document did not save to filesystem:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask/", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/var/lib/myproject/myproject/website/blueprints/", line 23, in create_document
    result = schemas.DocumentSchema().dump(utils.uploaded_document())
  File "/var/lib/myproject/myproject/website/", line 39, in uploaded_document
  File "/usr/local/lib/python3.7/site-packages/werkzeug/", line 2803, in save
    copyfileobj(, dst, buffer_size)
  File "/usr/local/lib/python3.7/", line 82, in copyfileobj
AttributeError: 'PosixPath' object has no attribute 'write'

Expected Behavior

Uploaded file document saved to filesystem.


Python: 3.7.4
Werkzeug: 0.16.0

@davidism davidism changed the title does not support pathlib does not support pathlib Oct 17, 2019
@davidism davidism added this to the 1.0.0 milestone Oct 18, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet

Successfully merging a pull request may close this issue.

2 participants