ideclonOriginal post
Rank 6: Server
Uploading any file which is chunked with the Python SDK (using InputFile.from_bytes()) fails.
I wasn't entirely sure whether from_bytes() is supposed to take a bytesarray or an io.BytesIO object, but since the SDK calls len() on the input, I'm assuming it takes a bytesarray.
The error is:
Traceback (most recent call last):
File "[PATH_TO_PYTHON_REDACTED]/site-packages/appwrite/client.py", line 100, in call
response.raise_for_status()
File "[PATH_TO_PYTHON_REDACTED]/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://[APPWRITE_ENDPOINT]/v1/storage/buckets/[BUCKET_ID]/files
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "[MY_SCRIPT_PATH].py", line 40, in <module>
file_storage = storage.create_file('[BUCKET_ID]', 'unique()', input_file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[PATH_TO_PYTHON_REDACTED]/site-packages/appwrite/services/storage.py", line 156, in create_file
return self.client.chunked_upload(api_path, {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[PATH_TO_PYTHON_REDACTED]/site-packages/appwrite/client.py", line 175, in chunked_upload
result = self.call(
^^^^^^^^^^
File "[PATH_TO_PYTHON_REDACTED]/site-packages/appwrite/client.py", line 112, in call
raise AppwriteException(response.json()['message'], response.status_code, response.json().get('type'), response.json())
appwrite.exception.AppwriteException: Server Error
Summary
Unable to upload large files using `InputFile.from_bytes()` in the Python SDK. The error message indicates that the chunked upload fails. It's unclear whether `from_bytes()` should take a `bytesarray` or an `io.BytesIO` object, but the code assumes it takes a `bytesarray`. The error traceback suggests a server error.
Unfortunately, there is no solution provided in the support thread.