Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7922481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:58:06+00:00 2026-06-03T16:58:06+00:00

This is my first post here. I have been reading posts here since I

  • 0

This is my first post here.

I have been reading posts here since I started learning python and it has been nothing but a great help to my learning process. So, just want to say A BIG THANK YOU to you all before my question!

Question:

I installed the cjklib package successfully. Then, I installed the CEDICT dictionary successfully as well. But when I try to use CEDICT, it always throws errors like this:

>>> d = CEDICT()
......
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/default.py", line 335, in do_execute
sqlalchemy.exc.OperationalError: (OperationalError) unknown database "cedict_0" 'PRAGMA "cedict_0".table_info("CEDICT")' ()
>>> 

To reproduce the problem:

Install the cjklib package:

Download the cjklib-0.3.tar.gz, extract it and update the files in directory Cjklib-0.3/cjklib/build/*.py (specifically, builder.py and init.py):

Update “from sqlalchemy.exceptions” to “from sqlalchemy.exc”

$cd djklib-0.3/cjklib/build/
$sudo python setup.py install
$sudo installcjkdict CEDICT
$python
Python 2.7.3 (default, Apr 20 2012, 22:39:59) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from cjklib.dictionary import CEDICT
>>> d = CEDICT()

The error occurs, in details, as below:

>>> d = CEDICT()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/cjklib/dictionary/__init__.py", line 605, in __init__
    super(CEDICT, self).__init__(**options)
  File "/usr/local/lib/python2.7/dist-packages/cjklib/dictionary/__init__.py", line 532, in __init__
    super(EDICTStyleEnhancedReadingDictionary, self).__init__(**options)
  File "/usr/local/lib/python2.7/dist-packages/cjklib/dictionary/__init__.py", line 269, in __init__
    if not self.available(self.db):
  File "/usr/local/lib/python2.7/dist-packages/cjklib/dictionary/__init__.py", line 276, in available
    and dbConnectInst.hasTable(cls.DICTIONARY_TABLE))
  File "/usr/local/lib/python2.7/dist-packages/cjklib/dbconnector.py", line 444, in hasTable
    schema = self._findTable(tableName)
  File "/usr/local/lib/python2.7/dist-packages/cjklib/dbconnector.py", line 429, in _findTable
    if hasTable(tableName, schema=schema):
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 2525, in has_table
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 2412, in run_callable
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 1959, in run_callable
  File "build/bdist.linux-x86_64/egg/sqlalchemy/dialects/sqlite/base.py", line 567, in has_table
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 1450, in execute
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 1627, in _execute_text
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 1697, in _execute_context
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 1690, in _execute_context
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/default.py", line 335, in do_execute
sqlalchemy.exc.OperationalError: (OperationalError) unknown database "cedict_0" 'PRAGMA "cedict_0".table_info("CEDICT")' ()
>>>

Tryouts:
I tried some solutions myself, like:

As the error indicated, it can’t find the table in the sqlite database file, so I edited the cjklib.conf file by adding following the line to tell it that the table is right here:

url = sqlite:////usr/local/share/cjklib/cedict.db

Then, it found the table CEDICT and stopped throwing the errors. But unfortunately, it started throwing another kind of error when I ran the code below:

>>> from cjklib import characterlookup
>>> cjk = characterlookup.CharacterLookup('T')

Error:

>>> cjk = characterlookup.CharacterLookup('T')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/cjklib/characterlookup.py", line 118, in __init__
    self.hasComponentLookup = self.db.hasTable('ComponentLookup')
  File "/usr/local/lib/python2.7/dist-packages/cjklib/dbconnector.py", line 444, in hasTable
    schema = self._findTable(tableName)
  File "/usr/local/lib/python2.7/dist-packages/cjklib/dbconnector.py", line 429, in _findTable
    if hasTable(tableName, schema=schema):
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 2525, in has_table
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 2412, in run_callable
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 1959, in run_callable
  File "build/bdist.linux-x86_64/egg/sqlalchemy/dialects/sqlite/base.py", line 567, in has_table
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 1450, in execute
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 1627, in _execute_text
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 1697, in _execute_context
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py", line 1690, in _execute_context
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/default.py", line 335, in do_execute
sqlalchemy.exc.OperationalError: (OperationalError) unknown database "cjklib_0" 'PRAGMA "cjklib_0".table_info("ComponentLookup")' ()

If i delete the line I added, it will work as expected again.

Solutions:

How can I make it read both cedict.db and cjklib.db at the same time? I am guessing, only then, it might work for both cases without throwing any errors.

Did anyone encounter a similar situation? And how did you solve it? Or, do you have anything else to try out in mind? Just shed some lights please!

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:58:08+00:00Added an answer on June 3, 2026 at 4:58 pm

    (1) Your method to make CEDICT work is not complete. Although “d = CEDICT()” doesn’t raise any error, you will meet an error when you a dictionary function, such as “d.getFor(u’朋友’)”. You should add an item in the config file:

    attach = sqlite:////usr/local/share/cjklib/cjklib.db
    

    But, this method still gives a “characterlookup” error (as you mentioned).

    (2) Real solution: create “dbconnection” explicitly for the dictionary.

    >>> from cjklib.dictionary import CEDICT
    >>> from cjklib.dbconnector import getDBConnector
    >>> db = getDBConnector({'sqlalchemy.url': 'sqlite://', 'attach': ['cjklib']})
    >>> d=CEDICT(dbConnectInst=db)
    >>> it=d.getFor(u'朋友')
    

    EDIT:

    Keep cjklib.conf with default configuration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello all this is my first post here i have been working in an
This is my first post, but I have been using this site for a
Ok this is my first post on Stack Overflow I have been reading for
This is my first post here, recently i have been working with JSF2.0 with
it's my first post in here, but you have been helping me indirectly in
This is my first post here. I have a problem. I need to take
Well, this is my first post here and really enjoying the site. I have
Usless Background Info Hello, all. This is my first post here, but I often
I have been trying to follow the example in this post . Since I
This is my first question here. I have been searching Stack Overflow and other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.