Re: PyEnchant Spell Checker Issue

102 views
Skip to first unread message

Donald Hirst

unread,
Jan 15, 2013, 7:18:05 PM1/15/13
to leo-e...@googlegroups.com
I checked my PyEnchant dictionary, it is the proper format, so something else is going off...  I'll continue to look for the problem. 

Suggestions welcomed.

D Hirst


On Tuesday, January 15, 2013 1:51:01 PM UTC-8, Donald Hirst wrote:
OK, I'm a newby.  So far, I've successfully set up Leo editor and figured out how to get the latest build; that fixed one error.  Now I am seeing another that was reported as fixed -- PyEnchant doesn't handle crlf (windows text file) nicely as its dictionary.  I posted a comment about this at:  https://bugs.launchpad.net/leo-editor/+bug/787669?comments=all 

Thanks for any suggestions about getting this resolved, in general.  Meanwhile, I'll check the relevant file to ensure it is a Unix style (lf only) file and see if that makes PyEnchant happier.  This is interesting stuff, now I just have to figure out how to use it for my needs.

Thanks all.

Edward K. Ream

unread,
Jan 16, 2013, 4:15:47 PM1/16/13
to leo-e...@googlegroups.com
On Tue, Jan 15, 2013 at 6:18 PM, Donald Hirst <dvh...@aol.com> wrote:
I checked my PyEnchant dictionary, it is the proper format, so something else is going off...  I'll continue to look for the problem.

Rev 5572 now cleans spellpxy.txt (ensures Linux newlines) before trying to open it.  This may not solve your particular problem, but I think it's a good thing to do.

Edward

Donald Hirst

unread,
Jan 18, 2013, 7:52:33 PM1/18/13
to leo-e...@googlegroups.com
Edward,

Thanks for this activity; unfortunately, it didn't resolve the problem.  I am still looking; after loading the latest update (which includes Rev 5572) at http://www.greygreen.org/leo/ and running it, I still get:

Traceback (most recent call last):

  File "c:\program files (x86)\leo-editor-latest\leo\core\leoEditCommands.py", line 11078, in __init__
    self.d = enchant.DictWithPWL(language,fn)

  File "c:\python33\lib\site-packages\enchant\__init__.py", line 735, in __init__
    self.pwl = self._broker.request_pwl_dict(pwl)

  File "c:\python33\lib\site-packages\enchant\__init__.py", line 280, in request_pwl_dict
    self._raise_error(eStr % (pwl,))

  File "c:\python33\lib\site-packages\enchant\__init__.py", line 219, in _raise_error
    raise eclass(err)

enchant.errors.Error: b"Couldn't open personal wordlist 'C:\\program files (x86)\\leo-editor-latest\\leo\\plugins\\spellpyx.txt'"

not a valid dictionary file C:\program files (x86)\leo-editor-latest\leo\plugins\spellpyx.txt


My next steps are to looking to the definition of a well-formed PWL for aspell and ispell; maybe that will give me a clue about why the pyenchant wrapper is throwing the error flag...

Regards, 

DvH

Donald Hirst

unread,
Jan 20, 2013, 6:27:16 PM1/20/13
to leo-e...@googlegroups.com
Hello Edward,

This time I found the problem and fixed it.  A second look at spellpyx.txt verified that it is a Linux style file, with lines terminating in \n.  That is most of them do; the final line in the as downloaded file has no terminating \n.  Adding that final \n to the last line in the file has fixed my problem.  

I am not sure how spellpyx.txt is generated, but if by program, the program should be changed to incorporate the final \n character.  

After adding the \n, my Leo log is clean:
Leo Log Window
Leo 4.11 devel, build 5572, 2013-01-18 02:53:19 -0600
Python 3.3.0, qt version 4.8.4
Windows 6, 1, 7601, 2, Service Pack 1
leoID=dvhirst (in C:\Users\Donald Hirst\.leo)
load dir: C:\Program Files (x86)\leo-editor-latest\leo\core
global config dir: C:\Program Files (x86)\leo-editor-latest\leo\config
home dir: C:\Users\Donald Hirst
reading settings in C:\Program Files (x86)\leo-editor-latest\leo\config\leoSettings.leo
reading settings in C:\Users\Donald Hirst\.leo\workbook.leo
reading: C:\Users\Donald Hirst\.leo\workbook.leo

Thanks, and I'm on to my next challenge -- learning to effectively use Leo.  It should prove interesting.

Regards,

DvH
Reply all
Reply to author
Forward
0 new messages