# leo



## MNIHKLOM (Dec 1, 2012)

Hi,

I installed editors/leo prior to 9.0 RELEASE and used to experimented with without any errors.  But now when I `% leo` I get some errors that said

```
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/leo/core/runLeo.py", line 91, in <module>
    run()
  File "/usr/local/lib/python2.7/site-packages/leo/core/runLeo.py", line 87, in run
    g.app.loadManager.load(fileName,pymacs)
  File "/usr/local/lib/python2.7/site-packages/leo/core/leoApp.py", line 1549, in load
    ok = lm.doPostPluginsInit()
  File "/usr/local/lib/python2.7/site-packages/leo/core/leoApp.py", line 1925, in doPostPluginsInit
    c = c1 = lm.loadLocalFile(fn,gui=g.app.gui,old_c=None)
  File "/usr/local/lib/python2.7/site-packages/leo/core/leoApp.py", line 2148, in loadLocalFile
    c = lm.openFileByName(fn,gui,old_c,previousSettings)
  File "/usr/local/lib/python2.7/site-packages/leo/core/leoApp.py", line 2176, in openFileByName
    previousSettings=previousSettings)
  File "/usr/local/lib/python2.7/site-packages/leo/core/leoApp.py", line 624, in newCommander
    return leoCommands.Commands(fileName,relativeFileName,gui,previousSettings)
  File "/usr/local/lib/python2.7/site-packages/leo/core/leoCommands.py", line 111, in __init__
    c.finishCreate()
  File "/usr/local/lib/python2.7/site-packages/leo/core/leoCommands.py", line 379, in finishCreate
    c.frame.log.finishCreate()
  File "/usr/local/lib/python2.7/site-packages/leo/plugins/qtGui.py", line 5013, in finishCreate
    c.spellCommands.openSpellTab()
  File "/usr/local/lib/python2.7/site-packages/leo/core/leoEditCommands.py", line 10094, in openSpellTab
    self.handler = spellTabHandler(c,tabName)
  File "/usr/local/lib/python2.7/site-packages/leo/core/leoEditCommands.py", line 10166, in __init__
    self.spellController = EnchantClass(c)
  File "/usr/local/lib/python2.7/site-packages/leo/core/leoEditCommands.py", line 10376, in __init__
    self.d = enchant.Dict(language) 
  File "/usr/local/lib/python2.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 "/usr/local/lib/python2.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 "/usr/local/lib/python2.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
```

My system now is

```
[MNIHKLOM] ~% uname -a
FreeBSD MNIHKLOM.jesgroup.in.th 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0: Thu Nov 29 15:56:20 ICT 2012     [email]root@MNIHKLOM.jesgroup.in.th[/email]:/kaitag/obj/usr/src/sys/THUNYALICE  amd64
```

Many thanks for helps and hints.

With best regards,
MNIHKLOM


----------



## wblock@ (Dec 1, 2012)

MNIHKLOM said:
			
		

> I installed editors/leo prior to 9.0 RELEASE and used to experimented with without any errors.  But now when I `% leo` I get some errors that said
> 
> ```
> Traceback (most recent call last):
> ...



Looks like a problem with textproc/enchant or the Python module for it, textproc/py-enchant.  For a start, reinstall both of those.


----------



## MNIHKLOM (Dec 1, 2012)

wblock@ said:
			
		

> Looks like a problem with textproc/enchant or the Python module for it, textproc/py-enchant.  For a start, reinstall both of those.



Many thanks indeed but I still get the same errors.  Calling from within python is OK even enchant complains about dictionary can not be found though.


With best regards,
MNIHKLOM


----------



## cpm@ (Dec 1, 2012)

MNIHKLOM said:
			
		

> Many thanks indeed but I still get the same errors.  Calling from within python is OK even enchant complains about dictionary can not be found though.
> 
> 
> With best regards,
> MNIHKLOM



I think the application is not able to find the path where dictionaries are installed, anyway, you can check if you have dictionaries available, from a Python prompt type:

```
import enchant
print enchant.list_languages()
```

To check it works:

```
import enchant
d = enchant.Dict('en_US')
d.check("enchant") # True
d.check("enchnt") # False
d.suggest ("enchnt") # ['enchant', 'enchants', 'enchanter', 'penchant', 'incant', 'enchain', 'enchanted']
```

For more info, take a look enchant: Access to the enchant spellchecking library.


----------



## MNIHKLOM (Dec 2, 2012)

cpu82 said:
			
		

> I think the application is not able to find the path where dictionaries are installed, anyway, you can check if you have dictionaries available, from a Python prompt type:
> 
> ```
> import enchant
> ...




Hi,

I got an empty list for the first one and numerous errors output after the import command for the second one, 
	
	



```
d = enchant.Dict('en_US')
```

Anyway, I tried deinstalling/reinstallin enchant and py-enchant but still got the same error message


> enchant.errors.DictNotFoundError: Dictionary for language 'en_US' could not be found



This looks like dictionary is misplaced during installation or enchant looks for a specific location not specified by the port.

I really thank you very much for your hints and for your times.

With best regards,
MNIHKLOM


----------



## cpm@ (Dec 2, 2012)

It is possible, also need to install editors/abiword to solve this error you describe.

I suggest this possibility because it worked under linux.


----------



## MNIHKLOM (Dec 2, 2012)

cpu82 said:
			
		

> It is possible, also need to install editors/abiword to solve this error you describe.
> 
> I suggest this possibility because it worked under linux.



Hi,

I still got the same result even when I delete leo, py27-enchant, enchant, prior to add abiword and reinstall leo afterward.   Many thanks to you indeed for valuable hints and for your times.

With best regards,
MNIHKLOM


----------



## cpm@ (Dec 2, 2012)

I did not asked you before, if you installed some dictionary. Read enchant(1) for how to do this.

Extracted from his website:


> Similarly, several of Enchant's backends support user + global dictionaries. This includes the Ispell, Uspell, and Myspell backends. Users may have locally installed dictionaries (for example, in ~/.enchant/ispell or ~/.enchant/uspell) in addition to any globally installed ones. As with plugins, the user-defined dictionaries will always take precedence over the globally installed ones.



Locate the appropriate file on their dictionary download page at http://wiki.openoffice.org/wiki/Dictionaries#English_.28AU.2CCA.2CGB.2CNZ.2CUS.2CZA.29.


----------



## MNIHKLOM (Dec 3, 2012)

cpu82 said:
			
		

> I did not asked you before, if you installed some dictionary. Read  for how to do this.
> 
> Extracted from his website:
> 
> ...



Hi,

I tried setting environment variable ${DICTIONARY} to /usr/local/share/ispell/english.hash, as suggested in enchant(1) , but still having another error message, here is the last line


> File "/usr/local/lib/python2.7/site-packages/leo/core/leoApp.py", line 488, in createQtGui
> import PyQt4.QtGui
> RuntimeError: the sip module implements API v8.0 to v8.1 but the PyQt4.QtGui module requires API v9.1


I am now manually downgraded to the last old good version but have not yet found.

I appreciate all efforts in helping me for this rather special problem.  Helps and hints are still needed and are welcome.

With best regards,
MNIHKLOM


----------



## cpm@ (Dec 3, 2012)

It appears that devel/py-sip upgrade breaks devel/py-qt4. You can downgrade editors/leo to version 4.10 following this steps:

First, install ports-mgmt/portdowngrade port:

```
# cd /usr/ports/ports-mgmt/portdowngrade && make DEFAULT_CVS_SERVER=\â€:pserver:anoncvs@anoncvs1.FreeBSD.org:/home/ncvs\â€ install clean
# rehash
```

Then downgrade ports:
`#  portdowngrade editors/leo`


----------



## MNIHKLOM (Dec 3, 2012)

Hi,

I reinstalled almost every ports related to this problem including lang/python27 and changed SIP_VERSION in devel/py-sip/files/bsd.pyqt.mk to the newest one, 4.14.x,  which brought me another inconsistency so I reverted SIP_VERION back to its' original value and built devel/py-qt4-gui without API.

As one can expect, enchant comes back with complaining for dictionary.  Looking at /usr/local/lib/python2.7/site-packages/pyenchant-1.6.5-py2.7.egg/enchant/share/enchant/ispell/
 make thing clear.  There is one(1) file , README.txt.

Any idea or suggestion please.

With best regards,
MNIHKLOM


----------



## cpm@ (Dec 4, 2012)

You need install textproc/aspell, then dictionaries will be installed and ready for use. 

For myspell backend, installed dictionaries be stored in /usr/local/lib/python2.7/site-packages/pyenchant-1.6.5-py2.7.egg/enchant/share/enchant/myspell/ directory.


----------



## MNIHKLOM (Dec 4, 2012)

cpu82 said:
			
		

> You need install textproc/aspell, then dictionaries will be installed and ready for use.
> 
> Dictionaries be stored in /usr/local/lib/python2.7/site-packages/pyenchant-1.6.5-py2.7.egg/enchant/share/enchant/myspell/ directory.



Hi,

I have done that and the same line of code, line 218, produces the same message.  Even I cp all files form /usr/local/share/ispell/* to the location mentioned above, that error still remains.

Also there is one(1) file in /usr/local/lib/python2.7/site-packages/pyenchant-1.6.5-py2.7.egg/enchant/share/enchant/myspell/ after aspell has been installed.

Once again, I thank you very much for kindness and your times.

With best regards,
MNIHKLOM


----------



## MNIHKLOM (Dec 4, 2012)

Hi,

I installed textproc/en-aspell and cp all /usr/local/share/aspell/en* to the location /usr/local/lib/python2.7/site-packages/pyenchant-1.6.5-py2.7.egg/enchant/share/enchant/myspell/ and leo roar happily.  At least I get a Leo frame as usual.

I thank you indeed for all efforts for all of your times in helping me.

With best regards,
MNIHKLOM


----------



## cpm@ (Dec 4, 2012)

Please, read Which Enchant provider should I use? (Aspell, Ispell, MySpell...?) FAQ section. 

I must mention that should work the three spellchecking providers, review your configuration in accordance to provider shootout document.

For example:

If you want use myspell, copy OpenOffice.org dictionaries (see Comment 8) in /usr/local/lib/python2.7/site-packages/pyenchant-1.6.5-py2.7.egg/enchant/share/enchant/myspell/. Remove first, aspell dictionaries. It is important not to mix.

From source http://packages.python.org/pyenchant/api/enchant.html:


> set_param(*name*, *value*)
> 
> Set the value of a named parameter on this broker.
> 
> Parameters are used to provide runtime information to individual provider backends. For example, the myspell provider will search any directories given in the â€œenchant.myspell.dictionary.pathâ€ parameter when looking for its dictionary files.



Try:

```
enchant.set_param("enchant.myspell.dictionary.path", "/usr/local/lib/python2.7/site-packages/pyenchant-1.6.5-py2.7.egg/enchant/share/enchant/myspell")
```


----------



## MNIHKLOM (Dec 4, 2012)

cpu82 said:
			
		

> Please, read Which Enchant provider should I use? (Aspell, Ispell, MySpell...?) FAQ section.
> 
> I must mention that should work the three spellchecking providers, review your configuration in accordance to provider shootout document.
> 
> ...



Hi,

I have to learn a lot in order to understand the topics you suggest.  I do not use Openoffice but libreoffice and  since my latop is quite so old that I can not intall libreoffice form port.

I am now reviewing what I have done for leo especially in en-aspell, why I have to manually copy dictionaries to "/usr/local/lib/python2.7/site-packages/pyenchant-1.6.5-py2.7.egg/enchant/share/enchant/myspell" and so on.

Your helps and hints are of great value to me and thank you indeed.

With best regards,
MNIHKLOM


----------

