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

Upload error: file is partial (410) #2

Open
predat opened this issue Apr 8, 2017 · 4 comments
Open

Upload error: file is partial (410) #2

predat opened this issue Apr 8, 2017 · 4 comments

Comments

@predat
Copy link

predat commented Apr 8, 2017

Hello,

I'm trying to upload a file to pydio with pydio-sdk-python but no matter the size of the file, it always return: Upload error: file is partial (410). I'm using python3.

My simple code:

sdk = PydioSdk(url="https://by.hrcls.tv",
               ws_id="my-files",
               remote_folder="/",
               user_id='',
               auth=('login', 'password'),
               skip_ssl_verify=True)

f = "/Volumes/data/Users/predat/dl.pdf"

sdk.upload(local=f,
           local_stat={'size': os.stat(f).st_size},
           path=os.path.basename(f),
           callback_dict=None)

the error:

Traceback (most recent call last):
  File "/Volumes/data/Users/predat/Documents/dev/python/pydio/pydiosdkpython/remote.py", line 727, in upload
    self.perform_request(url=url, type='post', data=data, files=files, with_progress=callback_dict)
  File "/Volumes/data/Users/predat/Documents/dev/python/pydio/pydiosdkpython/remote.py", line 331, in perform_request
    stream=stream, with_progress=with_progress)
  File "/Volumes/data/Users/predat/Documents/dev/python/pydio/pydiosdkpython/remote.py", line 277, in perform_with_tokens
    max_size=self.upload_max_size)
  File "/Volumes/data/Users/predat/Documents/dev/python/pydio/pydiosdkpython/remote.py", line 1054, in upload_file_with_progress
    parse_upload_rep(resp)
  File "/Volumes/data/Users/predat/Documents/dev/python/pydio/pydiosdkpython/remote.py", line 999, in parse_upload_rep
    raise PydioSdkDefaultException(str(http_response.text))
pydiosdkpython.exceptions.PydioSdkDefaultException: Upload error: file is partial (410)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 33, in <module>
    callback_dict=None)
  File "/Volumes/data/Users/predat/Documents/dev/python/pydio/pydiosdkpython/remote.py", line 729, in upload
    if e.message == '507':
AttributeError: 'PydioSdkDefaultException' object has no attribute 'message'
@predat
Copy link
Author

predat commented Apr 8, 2017

switching to 'python2' branch work after some modifications:

diff --git a/remote.py b/remote.py
index 7651509..2ec71a4 100644
--- a/remote.py
+++ b/remote.py
@@ -141,7 +141,7 @@ class PydioSdk():
         """
         if platform.system() == 'Darwin':
             try:
-                test = unicodedata.normalize('NFC', unicode_path)
+                test = unicodedata.normalize('NFC', unicode_path.decode('utf-8'))
                 unicode_path = test
             except ValueError as e:
                 logging.exception(e)
@@ -150,7 +150,7 @@ class PydioSdk():

     def normalize(self, unicode_path):
         try:
-            test = unicodedata.normalize('NFC', unicode_path)
+            test = unicodedata.normalize('NFC', unicode_path.decode('utf-8'))
             return test
         except ValueError as e:
             logging.exception(e)
@@ -159,7 +159,7 @@ class PydioSdk():
     def normalize_reverse(self, unicode_path):
         if platform.system() == 'Darwin':
             try:
-                test = unicodedata.normalize('NFD', unicode_path)
+                test = unicodedata.normalize('NFD', unicode_path.decode('utf-8'))
                 return test
             except ValueError as e:
                 logging.exception(e)

@victorratts13
Copy link

I also have this same error in my pydio

@casasfernando
Copy link

I can confirm that the same problem happens when building the module in Ubuntu 18.04 using the python-2 branch.
The code change mentioned above didn't solve the problem for me.
Running Pydio server 8.2.0.

Let me know if any other information is needed.

@casasfernando
Copy link

For future reference in my case the cause of the problem was that I was using a newer version of the requests module 2.18.4. Downgrading to requests 2.5.1 as stated in the requirements.txt file solved the problem for me.

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

No branches or pull requests

3 participants