dsnopek / anki-sync-server

A personal Anki sync server (so you can sync against your own server rather than AnkiWeb)
GNU Affero General Public License v3.0
744 stars 95 forks source link

Error sync after update local app #59

Closed LxPvlv closed 7 years ago

LxPvlv commented 7 years ago

After update descktop app fulfilled daily tasks. Pressed 'Sinchronize with AnkiWeb' and got following error.

An error occurred. It may have been caused by a harmless bug, 
or your deck may have a problem. 
To confirm it's not a problem with your deck, please run Tools > Check Database. 
If that doesn't fix the problem, please copy the following
into a bug report:
Caught exception:
  File "/usr/share/anki/aqt/sync.py", line 346, in run
    self.col.close(save=False)
  File "/usr/share/anki/anki/collection.py", line 156, in close
    self.db.execute("pragma journal_mode = delete")
  File "/usr/share/anki/anki/db.py", line 31, in execute
    res = self._db.execute(sql, a)
<class 'sqlite3.OperationalError'>: cannot change out of wal mode from within a transaction

Local base and AnkiWeb were sinchronized. But this message appear every time. Check Dtabase - OK.

agrueneberg commented 7 years ago

This was fixed in dae/anki@4430785122d57eb1f3564b9bd06f4636bda77e63. It wasn't related to anki-sync-server. I'm not sure if the maintainer of the Arch Linux anki package intentionally updated to an alpha version, but it seems a little early. Might cause some headaches for @dae.

Akendo commented 7 years ago

Welcome to ArchLinux ;-)

So far I can see the issue with the alpha version. They change to python3. Nice to have but this also affects the server directly, if run on the same side:

akendo@x240 ~/s/anki-sync-server> python ./ankiserverctl.py debug
Traceback (most recent call last):
  File "/home/akendo/.virtualenvs/anki-sync-server/bin/paster", line 11, in <module>
    sys.exit(run())
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/script/command.py", line 102, in run
    invoke(command, command_name, options, args[1:])
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/script/command.py", line 141, in invoke
    exit_code = runner.run(args)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/script/command.py", line 236, in run
    result = self.command()
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/script/serve.py", line 284, in command
    relative_to=base, global_conf=vars)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/script/serve.py", line 329, in loadapp
    **kw)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
    return context.create()
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 217, in invoke
    next_app = context.next_context.create()
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 144, in invoke
    **context.local_conf)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/urlmap.py", line 31, in urlmap_factory
    app = loader.get_app(app_name, global_conf=global_conf)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 350, in get_app
    name=name, global_conf=global_conf).create()
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 362, in app_context
    APP, name=name, global_conf=global_conf)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 454, in get_context
    section)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 476, in _context_from_use
    object_type, name=use, global_conf=global_conf)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 406, in get_context
    global_conf=global_conf)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 296, in loadcontext
    global_conf=global_conf)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 328, in _loadegg
    return loader.get_context(object_type, name, global_conf)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 620, in get_context
    object_type, name=name)
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 646, in find_egg_entry_point
    possible.append((entry.load(), protocol, entry.name))
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2355, in load
    return self.resolve()
  File "/home/akendo/.virtualenvs/anki-sync-server/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2361, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/akendo/src/anki-sync-server/AnkiServer/apps/sync_app.py", line 32, in <module>
    import anki
  File "/usr/share/anki/anki/__init__.py", line 8, in <module>
    raise Exception("Anki should be run with Python 3")
Exception: Anki should be run with Python 3
agrueneberg commented 7 years ago

I did some research and it looks like qtwebkit was phased out because it's unmaintained and riddled with security issues: https://www.archlinux.org/todo/phasing-out-qtwebkit/ The current stable version of Anki has a dependency on it, but Anki 2.1 doesn't (it uses qt5-webengine instead). That explains the update to an alpha version.

hnykda commented 7 years ago

I confirm that applying the fix from here manually in /usr/share/anki/anki/collection.py works. It is a quick fix for those who wanna use the version from the official repositories.

agrueneberg commented 7 years ago

The anki package has been removed from the official repositories. It is recommended to use the binary version from https://apps.ankiweb.net/ instead.

Akendo commented 7 years ago

seems like bad idea....