Python论坛  - 讨论区

标题:[python-chinese] Aspell导致Leo不能启动的补丁

2007年10月08日 星期一 19:28

Jack phil jack.phil在gmail.com
星期一 十月 8 19:28:15 HKT 2007

Leo <http://webpages.charter.net/edreamleo/front.html>是一个伟大的工具。我在Ubuntu
7.04上运行时出现了如下错误:

reading settings in /opt/leo/config/leoSettings.leo
reading /home/hero/.leoRecentFiles.txt
@enabled-plugins found in leoSettings.leo
rst3 plugin: SilverCity not loaded
err No word lists can be found for the language "zh_CN".
Traceback (most recent call last):
File "/opt/bin/leo", line 360, in
run()
File "/opt/bin/leo", line 125, in run
c,frame = createFrame(fileName)
File "/opt/bin/leo", line 192, in createFrame
c,frame = g.app.newLeoCommanderAndFrame(fileName=fileName,initEditCommanders=True)
File "/opt/leo/src/leoApp.py", line 575, in newLeoCommanderAndFrame
c.finishCreate(initEditCommanders)
File "/opt/leo/src/leoCommands.py", line 220, in finishCreate
c.frame.log.finishCreate()
File "/opt/leo/src/leoTkinterFrame.py", line 2081, in finishCreate
c.spellCommands.openSpellTab()
File "/opt/leo/src/leoEditCommands.py", line 7949, in openSpellTab
self.handler = spellTabHandler(c,tabName)
File "/opt/leo/src/leoEditCommands.py", line 8029, in __init__
self.loaded = self.init_aspell(c)
File "/opt/leo/src/leoEditCommands.py", line 8049, in init_aspell
self.aspell = AspellClass(c,dictionaryFileName,self.local_language_code)
File "/opt/leo/src/leoEditCommands.py", line 8333, in __init__
self.getAspellWithCtypes()
File "/opt/leo/src/leoEditCommands.py", line 8415, in getAspellWithCtypes
raise Exception('aspell checker not enabled')
Exception: aspell checker not enabled

那是因为 aspell <http://aspell.net/> 没有中文字典的缘故,稍作修改如下:

--- leoEditCommands.py.old      2007-09-15 19:41:04.000000000 +0800
+++ leoEditCommands.py  2007-10-06 21:08:08.000000000 +0800
@@ -8401,9 +8401,14 @@
          print aspell_config_replace(sc, "lang",self.local_language_code)
          print aspell_config_retrieve(sc, "lang")

+       # there is no chinese dictionary for aspell, so we replaced
with english language
+       # aspell and aspell-en (dictionary) should be installed
+        if aspell_config_retrieve(sc, "lang") == "zh_CN":
+            aspell_config_replace(sc, "lang", "en")
+
      possible_err = aspell.new_aspell_speller(sc)
      aspell.delete_aspell_config(c_int(sc))
-
+
      # Rudimentary error checking, needs more.
      if aspell.aspell_error_number(possible_err) != 0:
          print 'err', aspell_error_message(possible_err)

简单说就是把中文改成了英文,从而自动使用英文字典,当然,你得装有aspell和aspell-en (英文字典)。

不过我想更好的办法是可以在配置文件中设定。
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20071008/5563151a/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: leoEditCommands.patch
Type: text/x-patch
Size: 814 bytes
Desc: not available
Url : http://python.cn/pipermail/python-chinese/attachments/20071008/5563151a/attachment.bin 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月08日 星期一 20:10

Zoom.Quiet zoom.quiet在gmail.com
星期一 十月 8 20:10:47 HKT 2007

On 10/8/07, Jack phil <jack.phil在gmail.com> wrote:
>
>
> Leo是一个伟大的工具。我在Ubuntu 7.04上运行时出现了如下错误:
??
俺也是在 Ubuntu 7.04 下面哪,使用的是
Leo 4.4.3 alpha 2, build  1.131 , March 17, 2007
Python 2.5.1, Tk 8.4.14
没有任何问题的哪,
嗯嗯嗯,这是插件的问题,
俺的经验是尽量少使用插件... 嗬嗬嗬
> reading settings in /opt/leo/config/leoSettings.leo
> reading /home/hero/.leoRecentFiles.txt
>
> @enabled-plugins found in leoSettings.leo
> rst3 plugin: SilverCity not loaded
> err No word lists can be found for the language "zh_CN".
> Traceback (most recent call last):
> File "/opt/bin/leo", line 360, in
>
> run()
> File "/opt/bin/leo", line 125, in run
> c,frame = createFrame(fileName)
> File "/opt/bin/leo", line 192, in createFrame
> c,frame =
> g.app.newLeoCommanderAndFrame(fileName=fileName,initEditCommanders=True)
>
> File "/opt/leo/src/leoApp.py", line 575, in newLeoCommanderAndFrame
> c.finishCreate(initEditCommanders)
> File "/opt/leo/src/leoCommands.py", line 220, in finishCreate
> c.frame.log.finishCreate
> ()
> File "/opt/leo/src/leoTkinterFrame.py", line 2081, in
> finishCreate
> c.spellCommands.openSpellTab()
> File "/opt/leo/src/leoEditCommands.py", line 7949, in
> openSpellTab
> self.handler = spellTabHandler(c,tabName)
>
> File "/opt/leo/src/leoEditCommands.py", line 8029, in
> __init__
> self.loaded = self.init_aspell(c)
> File "/opt/leo/src/leoEditCommands.py", line 8049, in
> init_aspell
> self.aspell = AspellClass(c,dictionaryFileName,
> self.local_language_code)
> File "/opt/leo/src/leoEditCommands.py", line 8333, in
> __init__
> self.getAspellWithCtypes()
> File "/opt/leo/src/leoEditCommands.py", line 8415, in
> getAspellWithCtypes
>
> raise Exception('aspell checker not enabled')
> Exception: aspell checker not enabled
>
> 那是因为 aspell 没有中文字典的缘故,稍作修改如下:
>
> --- leoEditCommands.py.old 2007-09-15 19:41:04.000000000 +0800
> +++ leoEditCommands.py 2007-10-06 21:08:08.000000000 +0800
> @@ -8401,9 +8401,14 @@
>  print aspell_config_replace(sc, "lang",
> self.local_language_code)
>  print aspell_config_retrieve(sc, "lang")
>
> + # there is no chinese dictionary for aspell, so we replaced with english
> language
> + # aspell and aspell-en (dictionary) should be installed
>
> + if aspell_config_retrieve(sc, "lang") == "zh_CN":
> + aspell_config_replace(sc, "lang", "en")
> +
>  possible_err = aspell.new_aspell_speller(sc)
>
>  aspell.delete_aspell_config(c_int(sc))
> -
> +
>  # Rudimentary error checking, needs more.
>  if aspell.aspell_error_number(possible_err) != 0:
>  print 'err', aspell_error_message(possible_err)
>
>
> 简单说就是把中文改成了英文,从而自动使用英文字典,当然,你得装有aspell和aspell-en (英文字典)。
>
> 不过我想更好的办法是可以在配置文件中设定。
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to
> python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to
> python-chinese-request在lists.python.cn
> Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
'''Time is unimportant, only life important!
过程改进其实是开始促生可以产生靠谱的人的组织!
'''http://zoomquiet.org
blog  @ http://blog.zoomquiet.org/pyblosxom/
wiki  @ http://wiki.woodpecker.org.cn/moin/ZoomQuiet
scrap @ http://floss.zoomquiet.org
share @ http://share.zoomquiet.org
douban@ http://www.douban.com/people/zoomq/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Pls. usage OOo to replace M$ Office. http://zh.openoffice.org
Pls. usage 7-zip to replace WinRAR/WinZip.  http://7-zip.org
You can get the truely Freedom 4 software.

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月08日 星期一 22:01

Jack phil jack.phil在gmail.com
星期一 十月 8 22:01:17 HKT 2007

在07-10-8,Zoom. Quiet <zoom.quiet at gmail.com> 写道:
>
>
> 俺也是在 Ubuntu 7.04 下面哪,使用的是
> Leo 4.4.3 alpha 2, build  1.131 , March 17, 2007
> Python 2.5.1, Tk 8.4.14
> 没有任何问题的哪,
> 嗯嗯嗯,这是插件的问题,
>

系统有没有装aspell?如果装了的话就有问题。好象自动检测启动的,我把plugins全禁止了也一样。Python2.4正常。
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20071008/29ccfa24/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月08日 星期一 23:03

Xupeng Yun recordus在gmail.com
星期一 十月 8 23:03:57 HKT 2007

Jack phil 写道:
> 在07-10-8,*Zoom. Quiet* <zoom.quiet at gmail.com
> zoom.quiet at gmail.com>> 写道:
>
>
>     俺也是在 Ubuntu 7.04 下面哪,使用的是
>     Leo 4.4.3 alpha 2, build 1.131 , March 17, 2007
>     Python 2.5.1, Tk 8.4.14
>     没有任何问题的哪,
>     嗯嗯嗯,这是插件的问题,
>
>
> 系统有没有装aspell?如果装了的话就有问题。好象自动检测启动的,我把
> plugins全禁止了也一样。Python2.4正常。

我在archlinux下最初也遇到了和你一样的问题,不过我检查了一下我没有aspell-
en这个包,我安装了这个包以后leo就正常了,你不妨看看你有没有aspell-en

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号