Pyenchant cannot find dictionary file on Mac OS X

I'm having trouble installing pyenchant on a MacbookPro running Lion. I used homebrew and pip to set enchantment and peach.

homebrew install enchant

pip install pyenchant

I also downloaded the English dictionary to the following folder:

/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/enchant/share/enchant/myspell

-rw-r--r--  1 mycomputer  admin      75 Jun  6 13:34 README.txt
-rw-rw-rw-@ 1 mycomputer  staff    1017 May  4  2007 README_en_US.txt
drwx------@ 2 mycomputer  staff      68 Jun  6 13:38 en_US
-rw-rw-rw-@ 1 mycomputer  staff    3045 May  4  2007 en_US.aff
-rw-rw-rw-@ 1 mycomputer  staff  696131 May  4  2007 en_US.dic

However, when I try to use enchant, I get the following error.

>>> import enchant
>>> d = enchant.Dict('en_US')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/enchant/__init__.py", line 502, in __init__
    self._switch_this(broker._request_dict_data(tag),broker)
  File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/enchant/__init__.py", line 264, in _request_dict_data
    self._raise_error(eStr % (tag,),DictNotFoundError)
  File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/enchant/__init__.py", line 218, in _raise_error
    raise eclass(default)
enchant.errors.DictNotFoundError: Dictionary for language 'en_US' could not be found

I assume that I do not have dictionary files installed in the correct folder, but I do not know where else to install them.

Thank.

+5
source share
3 answers

Enchant is "lazy" and needs support from aspell.

So what you need to do:

brew remove aspell
brew install aspell --lang=en

en dicts , dicts.

+6

, . brew - mac-. oxt apache ( .oxt .zip. ?

Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)   
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin  
Type "help", "copyright", "credits" or "license" for more information.  
>>>  
>>> import enchant  
>>> d = enchant.Dict("en_US")  
Traceback (most recent call last):  
  File "<stdin>", line 1, in <module>  
  File "/Library/Python/2.7/site-packages/pyenchant-1.6.5-py2.7.egg/enchant/__init__.py", line 502,   in __init__  
    self._switch_this(broker._request_dict_data(tag),broker)   
  File "/Library/Python/2.7/site-packages/pyenchant-1.6.5-py2.7.egg/enchant/__init__.py", line 264, 
  in _request_dict_data  
    self._raise_error(eStr % (tag,),DictNotFoundError)  
  File "/Library/Python/2.7/site-packages/pyenchant-1.6.5-py2.7.egg/enchant/__init__.py", line 218,   in _raise_error  
    raise eclass(default)  
enchant.errors.DictNotFoundError: Dictionary for language 'en_US' could not be found  

, :

>>> enchant.set_param("enchant.myspell.dictionary.path","/Library/Python/2.7/site-packages/pyenchant-1.6.5-py2.7.egg/enchant/share/enchant/myspell")  
>>> d=enchant.Dict("en_US")
>>> d.check("enchant")  
True  
>>>   

- - ( Python Eggs - Java Jars)

+1

, :

enchant.set_param ( "enchant.myspell.dictionary.path", "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/enchant/share/enchant/myspell" )

, enchant , .

0

All Articles