derrix060 / onedriveClient

A Microsoft OneDrive and OneDrive for Business client for Linux, written in Python3.
MIT License
65 stars 10 forks source link

Syncing from web to local onOneDrive for Business #21

Open modelmat opened 6 years ago

modelmat commented 6 years ago

Deleting/creating an item from the web client results in the error below, failing the delete/create The value for KeyError varies within 1000-7000 (from what I've seen). Fine deleting / creating files on local and uploading. The initial sync worked, just later updates do not. This makes this program useless.

also should I be worried when --debug shows a large amount of adding watcher for {file}?

source_traceback: Object created at (most recent call last):
  File "/home/modelmat/.local/lib/python3.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/modelmat/.local/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/modelmat/.local/lib/python3.7/site-packages/daemonocle/cli.py", line 57, in subcommand
    daemon.do_action(name)
  File "/home/modelmat/.local/lib/python3.7/site-packages/daemonocle/core.py", line 608, in do_action
    func()
  File "/home/modelmat/.local/lib/python3.7/site-packages/daemonocle/core.py", line 477, in start
    self._run()
  File "/home/modelmat/.local/lib/python3.7/site-packages/daemonocle/core.py", line 399, in _run
    self.worker()
  File "/home/modelmat/.local/lib/python3.7/site-packages/onedrived/od_main.py", line 204, in main
    context.watcher = LocalRepositoryWatcher(task_pool=task_pool, loop=context.loop)
  File "/home/modelmat/.local/lib/python3.7/site-packages/onedrived/od_watcher.py", line 46, in __init__
    self.loop.add_reader(self.notifier.fd, self.process_events)
  File "/usr/lib/python3.7/asyncio/selector_events.py", line 335, in add_reader
    return self._add_reader(fd, callback, *args)
  File "/usr/lib/python3.7/asyncio/selector_events.py", line 260, in _add_reader
    handle = events.Handle(callback, args, self, None)
Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/modelmat/.local/lib/python3.7/site-packages/onedrived/od_watcher.py", line 441, in process_events
    self.handle_event(ev, flags, move_pairs)
  File "/home/modelmat/.local/lib/python3.7/site-packages/onedrived/od_watcher.py", line 339, in handle_event
    repo, parent_dir = self.watch_descriptors[ev.wd]
  File "/home/modelmat/.local/lib/python3.7/site-packages/bidict/_common.py", line 96, in proxy
    return meth(*args)
KeyError: 8924
[2018-09-29 16:28:38,563] WARNING: MainThread: Executing <Handle LocalRepositoryWatcher.process_events() created at /usr/lib/python3.7/asyncio/selector_events.py:260> took 0.205 seconds
127.0.0.1 - - [29/Sep/2018 16:28:45] "POST /90VCNElMDu HTTP/1.1" 200 -
[2018-09-29 16:28:45,603] INFO: Webhook: b'POST /90VCNElMDu HTTP/1.1\r\n'
derrix060 commented 6 years ago

That's weird because I use it every day and is working fine here... I'm wondering if can be something related with python3.7...

Anyway, I will look a this.

The number of " adding watcher for {file}" will depend on your configuration. You can see it on the onedrived_config_v2.json.

modelmat commented 6 years ago

So that's normal when in debug? Great! Thanks for having a look. If you need anything tested, I know my way around python so it should be fine.

derrix060 commented 6 years ago

I could reproduce it here. What I've found is the program logs this error, but the file/directory is created/deleted...

The program can take some time (depend of your configuration) to sync, so don't expect to delete a file remotely and see sync so fast.

modelmat commented 6 years ago

So it works but it errors?

derrix060 commented 6 years ago

As far I could test here it's working okay but I will take a deep look and will remove any bugs. This piece was edited one year ago is likely to have a bug there..

modelmat commented 6 years ago

Oh, okay.

modelmat commented 6 years ago

I've had a look at this again and it seems that this only occurs when I create a file with one name then (very) quickly rename it, then it spams the KeyError continuously. If it's not so quick it only does the KeyError once.

derrix060 commented 6 years ago

So even with the KeyError the sync could be completed?

modelmat commented 6 years ago

I'm not really sure. I think for doing it once it uploads, but for multiple (with unpaired watch events) it doesn't.