iwonbigbro / gsync

RSync for Google Drive - GSync
Other
238 stars 50 forks source link

ID = None cause File id mismatch errors on first upload #66

Closed GyroLand closed 9 years ago

GyroLand commented 10 years ago

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.

gabrewat commented 10 years ago

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").

orgnac commented 10 years ago

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

ghost commented 10 years ago

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

ingoha commented 10 years ago

Worked for me +1

keesverstoep commented 10 years ago

Worked for me too, thanks!

kgoderis commented 9 years ago

+1

dgitman commented 9 years ago

+1

dmutters commented 9 years ago

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?

p4r0d5 commented 9 years ago

yeah! it works! thanks a lot GyroLand.

sudsy commented 9 years ago

@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.

benfry commented 9 years ago

@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!

guillaumemorin commented 9 years ago

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 ;)

ramicio commented 9 years ago

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

arielscarpinelli commented 8 years ago

@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 8 years ago

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