iwonbigbro/gsync

ID = None cause File id mismatch errors on first upload

Closed this issue · 15 comments

Hi!

When uploading new files to drive, the ID comes up as None (as defined by SyncFileLocal.getInfo, i guess) in the properties, and this causes a http 400 error saying File ID mismatch.
I could actually fix this by changing the create method in class _Drive like this:

for k, v in properties.iteritems():
            if v is not None:
                body[k] = _Drive.utf8(v)

I am just not sure that this won't cause any other problems. I am using the latest pip version, not the git one. But i think the same would happen in the git version as well.

Thanks for the fix, GyroLand. Worked well for me and now Google Drive syncing is functional.
I had to search a little bit for where you changed the source. For me, that was in the file "/usr/lib/python2.6/site-packages/libgsync/drive/init.py" at about line #644-646 (parsing might remove the double underscore characters preceding and following "init").

This works for me too, but I don't understand the fix.

Same problem here.
@GyroLand Kudos for the fix :)

Worked for me +1

Worked for me too, thanks!

+1

It looks like this method works well, except when it runs into a file that ends in a ~ character. Then, you get this:

Monsters/Lvl. 3 - Undead Horrid Housecat~
           0   0%     0.00B/s    0:00:00DEBUG: 'Exception':   File "/usr/local/lib/python2.7/dist-packages/libgsync/drive/__init__.py", line 712, in update
    status, res = req.next_chunk()
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line 132, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/apiclient/http.py", line 874, in next_chunk
    return self._process_response(resp, content)
  File "/usr/local/lib/python2.7/dist-packages/apiclient/http.py", line 901, in _process_response
    raise HttpError(resp, content, uri=self.uri)

I think it's just an escaping issue, but since I don't know python, I'm not sure how to fix it. Any ideas?

yeah! it works! thanks a lot GyroLand.

@benfry Have you thought about a pull request to merge your fix into the main project? It would be great to have these issues resolved in the main project.

@sudsy I hadn't yet—I wasn't able to confirm whether the changes were enough to give me a working repo, but it looks like @iwonbigbro has merged them since. Thanks!

I've just installed the 0.1.14 version with pip on Debian 7.7 and I had to make the fix too (in /usr/local/lib/python2.7/dist-packages/libgsync/drive/init.py). Works well now, thx @GyroLand ;)

This doesn't work for me. First off, the --authentication flag doesn't do anything for me. It's not even listed under my help. Secondly, it doesn't upload anything. 0 bytes. I apply this "fix," and I just get errors:

Traceback (most recent call last):
File "/usr/local/bin/gsync", line 8, in
from libgsync.crawler import Crawler
File "/usr/local/lib/python2.7/dist-packages/libgsync/crawler.py", line 4, in
from libgsync.sync import Sync
File "/usr/local/lib/python2.7/dist-packages/libgsync/sync/init.py", line 5, in
from libgsync.drive.mimetypes import MimeTypes
File "/usr/local/lib/python2.7/dist-packages/libgsync/drive/init.py", line 646
body[k] = _Drive.utf8(v)
^
IndentationError: unindent does not match any outer indentation level

@iwonbigbro Could you please release a new version including this fix? You merged the patch in Jan but seems that never released the update to pypi. Thanks!

tevch commented

yes, please
i got the same issue, same fix
but please release it to pip