You are not logged in.

#1 2011-05-27 18:21:10

Baraclese
Member
Registered: 2008-05-28
Posts: 48

python2-sqlalchemy update broke anki

yesterday: [2011-05-26 22:18] upgraded python2-sqlalchemy (0.6.7-1 -> 0.7.0-1)

today when trying to start anki:

[~]$ anki
Traceback (most recent call last):
  File "/usr/bin/anki", line 27, in <module>
    ankiqt.run()
  File "/usr/lib/python2.7/site-packages/ankiqt/__init__.py", line 78, in run
    import config
  File "/usr/lib/python2.7/site-packages/ankiqt/config.py", line 10, in <module>
    from anki.utils import genID
  File "/usr/lib/python2.7/site-packages/anki/__init__.py", line 58, in <module>
    from anki.deck import DeckStorage
  File "/usr/lib/python2.7/site-packages/anki/deck.py", line 14, in <module>
    from anki.db import *
  File "/usr/lib/python2.7/site-packages/anki/db.py", line 33, in <module>
    from sqlalchemy.exceptions import DBAPIError, OperationalError
ImportError: No module named exceptions

Does anyone else see the same problem?

Offline

#2 2011-05-27 19:17:25

Baraclese
Member
Registered: 2008-05-28
Posts: 48

Re: python2-sqlalchemy update broke anki

I confirmed this by downgrading python2-sqlalchemy.
There's a bug report now at https://bugs.archlinux.org/task/24472

Offline

#3 2011-05-28 21:09:51

danielskoda
Member
Registered: 2009-02-24
Posts: 6

Re: python2-sqlalchemy update broke anki

Baraclese wrote:

yesterday: [2011-05-26 22:18] upgraded python2-sqlalchemy (0.6.7-1 -> 0.7.0-1)

today when trying to start anki:

[~]$ anki
Traceback (most recent call last):
  File "/usr/bin/anki", line 27, in <module>
    ankiqt.run()
  File "/usr/lib/python2.7/site-packages/ankiqt/__init__.py", line 78, in run
    import config
  File "/usr/lib/python2.7/site-packages/ankiqt/config.py", line 10, in <module>
    from anki.utils import genID
  File "/usr/lib/python2.7/site-packages/anki/__init__.py", line 58, in <module>
    from anki.deck import DeckStorage
  File "/usr/lib/python2.7/site-packages/anki/deck.py", line 14, in <module>
    from anki.db import *
  File "/usr/lib/python2.7/site-packages/anki/db.py", line 33, in <module>
    from sqlalchemy.exceptions import DBAPIError, OperationalError
ImportError: No module named exceptions

Does anyone else see the same problem?

I had the same problem. The error code is the same, too.
Downgrading python2-sqlalchemy from 0.7.0-1 to 0.6.7-1 solved my problem for now.

Offline

#4 2011-06-08 03:19:17

senorsmile
Member
Registered: 2010-12-12
Posts: 72

Re: python2-sqlalchemy update broke anki

danielskoda wrote:
Baraclese wrote:

yesterday: [2011-05-26 22:18] upgraded python2-sqlalchemy (0.6.7-1 -> 0.7.0-1)

today when trying to start anki:

[~]$ anki
Traceback (most recent call last):
  File "/usr/bin/anki", line 27, in <module>
    ankiqt.run()
  File "/usr/lib/python2.7/site-packages/ankiqt/__init__.py", line 78, in run
    import config
  File "/usr/lib/python2.7/site-packages/ankiqt/config.py", line 10, in <module>
    from anki.utils import genID
  File "/usr/lib/python2.7/site-packages/anki/__init__.py", line 58, in <module>
    from anki.deck import DeckStorage
  File "/usr/lib/python2.7/site-packages/anki/deck.py", line 14, in <module>
    from anki.db import *
  File "/usr/lib/python2.7/site-packages/anki/db.py", line 33, in <module>
    from sqlalchemy.exceptions import DBAPIError, OperationalError
ImportError: No module named exceptions

Does anyone else see the same problem?

I had the same problem. The error code is the same, too.
Downgrading python2-sqlalchemy from 0.7.0-1 to 0.6.7-1 solved my problem for now.

I have tried downgrading it by downloading the file python-sqlalchemy-0.6.7-1-any.pkg.tar and running:
pacman -U python-sqlalchemy-0.6.7-1-any.pkg.tar.xz

However, I get the exact same error a few cards in.  Am I downgrading incorrectly or are the errors coming from somewhere else?

Offline

#5 2011-06-08 04:15:30

senorsmile
Member
Registered: 2010-12-12
Posts: 72

Re: python2-sqlalchemy update broke anki

I applied the patch written by the author of anki here:

http://code.google.com/p/anki/issues/detail?id=2563


I am not sure how to properly apply the patch, but here's what I did:
As per https://github.com/dae/libanki/commit/e … 7f442f80d3,
locate the anki/decks.py file and add the green lines, delete the red lines.  I used vim.

cd /usr/lib/python2.7/site-packages/anki/
vim deck.py
3782gg
i
            from sqlalchemy.pool import SingletonThreadPool
            # temporary tables are effectively useless with the default
            # settings in 0.7, so we need to force the pool class
<esc>
3786gg
dd
i
<cr>
                                   poolclass=SingletonThreadPool)
<esc>
:wq

Now anki is working perfectly.

Offline

#6 2011-06-08 18:17:05

Baraclese
Member
Registered: 2008-05-28
Posts: 48

Re: python2-sqlalchemy update broke anki

senorsmile wrote:

I have tried downgrading it by downloading the file python-sqlalchemy-0.6.7-1-any.pkg.tar and running:
pacman -U python-sqlalchemy-0.6.7-1-any.pkg.tar.xz

However, I get the exact same error a few cards in.  Am I downgrading incorrectly or are the errors coming from somewhere else?

Check your installed version by running 'pacman -Q python2-sqlalchemy'.

I am still using python2-sqlalchemy 0.6.7-1 and anki 1.2.8-1. Perhaps the minor update of anki to version 1.2.8-2 is causing the new problems for you. In that case you should try downgrading anki too.

Offline

#7 2011-06-16 19:11:08

Nicky726
Member
From: Czech Republic
Registered: 2008-02-15
Posts: 149

Re: python2-sqlalchemy update broke anki

With the patch senorsmile mentioned it works (anki based on 1.2.8-2 and python2-sqlalchemy 0.7.1-1). Here is quickly modified PKGBUILD (you still need the patch from abs):

# $Id: PKGBUILD 48125 2011-05-28 22:12:48Z jelle $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: Timm Preetz <timm@preetz.us>
# Contributor: Michael 'manveru' Fellinger <m.fellinger@gmail.com>
# Contributor: Dave Pretty <david dot pretty at gmail dot com>

pkgname=anki
pkgver=1.2.8
pkgrel=2
pkgdesc='Helps you remember facts (like words/phrases in a foreign language) efficiently.'
url='http://ankisrs.net/'
license=("GPL")
arch=('any')
depends=('python2-qt' 'python2-sqlalchemy' 'python-simplejson' 'python-pysqlite' 'python-beautifulsoup')
optdepends=('python-matplotlib: show graphs'
            'sox: audio recording'
            'pyaudio: audio recording')
makedepends=('setuptools' 'desktop-file-utils')
source=(http://anki.googlecode.com/files/anki-$pkgver.tgz sqlalchemy.patch)

build() {
  cd $srcdir/$pkgname-$pkgver
  patch -Np1 -i $srcdir/sqlalchemy.patch
  export PYTHONPATH=$srcdir/$pkgname-$pkgver/libanki

  (cd libanki && python2 setup.py install --root $pkgdir)
  python2 setup.py install --root $pkgdir

  # .desktop file and icon
  desktop-file-install --dir $pkgdir/usr/share/applications $pkgname.desktop
  install -D -m 644 icons/$pkgname.png $pkgdir/usr/share/pixmaps/$pkgname.png

        # More patching
        sed -i -e "s/# open and lock connection for single use/from sqlalchemy.pool import SingletonThreadPool/" \
                "${pkgdir}/usr/lib/python2.7/site-packages/anki/deck.py"
        sed -i -e "s/strategy=\"threadlocal\")/poolclass=SingletonThreadPool)/" \
                "${pkgdir}/usr/lib/python2.7/site-packages/anki/deck.py"
}
md5sums=('0dc5f5bad979f57cab82e3757665f6c0'
         '0e11d193c96953a780d1a64efc2131d3')
md5sums=('0dc5f5bad979f57cab82e3757665f6c0'
         'ce97c1064678436952c2773e3f1fcdb8')

"Although the masters make the rules
For the wise men and the fools
I got nothing, Ma, to live up to."

Offline

#8 2011-06-16 19:13:16

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: python2-sqlalchemy update broke anki

@Nicky726
Are you sure the md5sums part (last lines on the PKGBUILD) is OK? I think it's better to leave just one array.

Last edited by karol (2011-06-16 19:14:43)

Offline

#9 2011-07-03 17:15:17

Nicky726
Member
From: Czech Republic
Registered: 2008-02-15
Posts: 149

Re: python2-sqlalchemy update broke anki

Guess I must have copied something wrong, souhld be only one of those.
Anyways there is a new version of anki in repos which is ok.


"Although the masters make the rules
For the wise men and the fools
I got nothing, Ma, to live up to."

Offline

#10 2011-07-11 14:11:17

cngn
Member
Registered: 2010-03-20
Posts: 65

Re: python2-sqlalchemy update broke anki

hey can you record sounds in anki? i have pyaudio and sox installed, 'sound recorder' in gnome records my voice, however anki outputs this 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 restart
Anki and run Tools > Advanced > Check Database.
If that doesn't fix the problem, please copy the following
into a bug report:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/site-packages/anki/sound.py", line 304, in run
    frames_per_buffer=chunk)
  File "/usr/lib/python2.7/site-packages/pyaudio.py", line 714, in open
    stream = Stream(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pyaudio.py", line 396, in __init__
    self._stream = pa.open(**arguments)
IOError: [Errno Invalid input device (no default output device)] -9996

Offline

#11 2011-07-11 19:20:41

jelly
Administrator
From: /dev/null
Registered: 2008-06-10
Posts: 716

Re: python2-sqlalchemy update broke anki

Hmm., so is the db issue still there?

Offline

#12 2011-07-18 19:17:56

Baraclese
Member
Registered: 2008-05-28
Posts: 48

Re: python2-sqlalchemy update broke anki

I don't do audio recording in anki. Probably not too many people do so there may still be an issue in that part of the code. You may want to report this upstream. Otherwise I haven't had any issues yet with the new version.

Offline

Board footer

Powered by FluxBB