You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my script that uses pycloud I cannot use folderid=folderid, where folderid is an integer, with the uploadfile method. It causes some exceptions and doesn't upload the file.
My script has fileinfo = pc.uploadfile(files=[upload_file], folderid=folderid) and is causes exceptions (see below). I have to change the folderid=folderid to path='/' like below:
Exceptions when folderid is used with pycloud.uploadfile:
File "/pcloud-upload/./pcloud-upload.py", line 215, in <module>
fileinfo = pc.uploadfile(files=[upload_file], folderid=folderid)
File "/home/alarm/.local/lib/python3.10/site-packages/pcloud/validate.py", line 19, in wrapper
return func(*args, **kwargs)
File "/home/alarm/.local/lib/python3.10/site-packages/pcloud/api.py", line 274, in uploadfile
return self._upload("uploadfile", files, **kwargs)
File "/home/alarm/.local/lib/python3.10/site-packages/pcloud/api.py", line 242, in _upload
m = MultipartEncoder(fields=fields)
File "/usr/lib/python3.10/site-packages/requests_toolbelt/multipart/encoder.py", line 125, in __init__
self._prepare_parts()
File "/usr/lib/python3.10/site-packages/requests_toolbelt/multipart/encoder.py", line 246, in _prepare_parts
self.parts = [Part.from_field(f, enc) for f in self._iter_fields()]
File "/usr/lib/python3.10/site-packages/requests_toolbelt/multipart/encoder.py", line 246, in <listcomp>
self.parts = [Part.from_field(f, enc) for f in self._iter_fields()]
File "/usr/lib/python3.10/site-packages/requests_toolbelt/multipart/encoder.py", line 494, in from_field
body = coerce_data(field.data, encoding)
File "/usr/lib/python3.10/site-packages/requests_toolbelt/multipart/encoder.py", line 472, in coerce_data
return CustomBytesIO(data, encoding)
File "/usr/lib/python3.10/site-packages/requests_toolbelt/multipart/encoder.py", line 535, in __init__
buffer = encode_with(buffer, encoding)
File "/usr/lib/python3.10/site-packages/requests_toolbelt/multipart/encoder.py", line 416, in encode_with
return string.encode(encoding)
AttributeError: 'int' object has no attribute 'encode'
When I change folderid to using path then I get expected result, the file is uploaded.
The text was updated successfully, but these errors were encountered:
In my script that uses pycloud I cannot use folderid=folderid, where folderid is an integer, with the uploadfile method. It causes some exceptions and doesn't upload the file.
My script has
fileinfo = pc.uploadfile(files=[upload_file], folderid=folderid)
and is causes exceptions (see below). I have to change thefolderid=folderid
topath='/'
like below:fileinfo = pc.uploadfile(files=[upload_file], path='/')
The pcloud api says that
path
is discouraged but still accepted. In lieu of path it provides afolderid
parameter: https://docs.pcloud.com/methods/file/uploadfile.htmlExceptions when
folderid
is used with pycloud.uploadfile:When I change
folderid
to usingpath
then I get expected result, the file is uploaded.The text was updated successfully, but these errors were encountered: