neocl / jamdict

Python 3 library for manipulating Jim Breen's JMdict, KanjiDic2, JMnedict and kanji-radical mappings
MIT License
130 stars 12 forks source link

`sqlite3.OperationalError: database is locked` when importing data (Windows) #44

Open blueridanus opened 3 months ago

blueridanus commented 3 months ago
$ python -m jamdict import
Jamdict 0.1a11.post2
Python library for using Japanese dictionaries and resources (Jim Breen's JMdict, KanjiDic2, KRADFILE, JMnedict)

Basic configuration
------------------------------------------------------------
JAMDICT_HOME: ~/.jamdict [OK]
jamdict-data: version 1.5.1a2 [OK]
Config file : Not available.
     Run `python3 -m jamdict config` to create configuration file if needed.

Data files
------------------------------------------------------------
Jamdict DB location: ~/extern/jamdict_data/jamdict_data/jamdict.db - [NOT FOUND]
JMDict XML file    : ~/.jamdict/data/JMdict_e.gz - [OK]
KanjiDic2 XML file : ~/.jamdict/data/kanjidic2.xml.gz - [OK]
JMnedict XML file  : ~/.jamdict/data/JMnedict.xml.gz - [OK]

Others
------------------------------------------------------------
puchikarui: version 0.1
chirptext : version 0.1.2
lxml      : False
Importing data to: ~/extern/jamdict_data/jamdict_data/jamdict.db
Started - [Creating Jamdict SQLite database. This process may take very long time ...]
WARNING:puchikarui.puchikarui:DB does not exist at ~/extern/jamdict_data/jamdict_data/jamdict.db. Setup is required.
WARNING:jamdict.util:Building Kanjidic2 DB using a different DB context None vs ~/extern/jamdict_data/jamdict_data/jamdict.db
ERROR:puchikarui.puchikarui:Query failed: q=INSERT INTO character (ID,literal,stroke_count,grade,freq,jlpt) VALUES (?,?,?,?,?,?) , p=(None, '亜', 7, '8', '1509', '1')
Traceback (most recent call last):
  File "~/.venv/Lib/site-packages/puchikarui/puchikarui.py", line 469, in execute
    _r = self.cur.execute(query, params)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: database is locked
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/.venv/Lib/site-packages/jamdict/__main__.py", line 2, in <module>
    tools.main()
  File "~/.venv/Lib/site-packages/jamdict/tools.py", line 294, in main
    app.run()
  File "~/.venv/Lib/site-packages/chirptext/cli.py", line 135, in run
    args.func(self, args)
  File "~/.venv/Lib/site-packages/jamdict/tools.py", line 83, in import_data
    jam.import_data()
  File "~/.venv/Lib/site-packages/jamdict/util.py", line 502, in import_data
    self.kd2.insert_chars(self.kd2_xml, ctx=kd_ctx)
  File "~/.venv/Lib/site-packages/jamdict/kanjidic2_sqlite.py", line 124, in insert_chars
    self.insert_char(c, ctx=ctx)
  File "~/.venv/Lib/site-packages/jamdict/kanjidic2_sqlite.py", line 132, in insert_char
    c.ID = ctx.character.save(c)
           ^^^^^^^^^^^^^^^^^^^^^
  File "~/.venv/Lib/site-packages/puchikarui/puchikarui.py", line 366, in save
    return self._context.insert_object(self._table, obj, columns, self._table._field_map)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.venv/Lib/site-packages/puchikarui/puchikarui.py", line 439, in insert_object
    self.insert_record(table, values, columns)
  File "~/.venv/Lib/site-packages/puchikarui/puchikarui.py", line 414, in insert_record
    self.execute(query, values)
  File "~/.venv/Lib/site-packages/puchikarui/puchikarui.py", line 469, in execute
    _r = self.cur.execute(query, params)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: database is locked