Fri, 27 Apr 2007

:: leo在Py2.5中的失败尝试

leo在Py2.5中的失败尝试

1. 背景

1.1. 思路

我的步骤和思路:

  1. 不能影响现存的Py2.4 环境
  2. 使用Py2.5 进行尝试

  3. 因为:
  4. LEO 仅仅需要Python with Tk+Pwm
    • (不过要求Tcl 不能使用线程支持参数)
  5. 所以:
  6. 只要安装好Py2.5 就可以:

1.2. 安装步骤

  1. 安装最新 Tcl/Tk
    download cvs snapshots from ftp://ftp.tcl.tk/pub/tcl/nightly-cvs/
    tcl/unix$ ./configure --enable-shared --enable-gcc
    $ make clean && make 
    $ sudo make install
    ...
    /tk/unix$ ./configure --enable-xft
    $ make clean && make 
    $ sudo make install
    ...
    

  2. 安装Python2.5 并绑定Tk8.5
  3. 根据前人Py2.5安装经验

    $ sudo cp path/to/libtcl8.5.so /usr/lib/
    $ sudo cp path/to/libtk8.5.so /usr/lib/
    ...
    /python2.5-2.5.1.orig$ ./configure --enable-unicode=ucs4 \
      --with-tk   --with-tk-library=/usr/local/lib --with-tk-include=/usr/local/include/tcl8.5 \
      --with-tcl-library=/usr/local/lib --with-tcl-include=/usr/local/include/tcl8.5 
    $  make clean && make
    $  make test
    

  4. 安装 LEO
  5. cp -r Pmw /usr/local/lib/python2.5/site-packages/
    cp -r leo-4-4-3-alpha-2 /opt/bin/
    

1.3. 失败的结果

  • OK,结果 在 /opt/bin/leo-4-4-3-alpha-2/src 中直接调用leo.py 可以运行;
  • 但是LEO 不能正當影响 Ctrl+c|v|s 等等各种操作;直接就死了...
    /opt/bin/leo-4.4.3a2/src$ python2.5 leo.py
    reading settings in /opt/bin/leo-4.4.3a2/config/leoSettings.leo
    reading /home/zoomq/.leoRecentFiles.txt
    rst3 plugin: SilverCity not loaded
    rst3 plugin not loaded: can not load docutils
    Traceback (most recent call last):
    
      File ''/opt/bin/leo-4.4.3a2/src/leoEditCommands.py'', line 7903, in getAspellWithCtypes
        self.aspell = aspell = ctypes.CDLL(g.os_path_join(self.aspell_bin_dir, ''aspell-15.dll''))
    
      File ''/usr/local/lib/python2.5/ctypes/__init__.py'', line 340, in __init__
        self._handle = _dlopen(self._name, mode)
    
    OSError: /opt/bin/leo-4.4.3a2/src/c:\aspell\bin/aspell-15.dll: cannot open shared object file: No such file or directory
    
    Traceback (most recent call last):
      File ''leo.py'', line 353, in <module>
        run()
      File ''leo.py'', line 138, in run
        g.app.gui.runMainLoop()
      File ''/opt/bin/leo-4.4.3a2/src/leoTkinterGui.py'', line 186, in runMainLoop
        self.root.mainloop()
      File ''/usr/local/lib/python2.5/lib-tk/Tkinter.py'', line 1023, in mainloop
        self.tk.mainloop(n)
      File ''/usr/local/lib/python2.5/site-packages/Pmw/Pmw_1_2/lib/PmwBase.py'', line 1751, in __call__
        _reporterror(self.func, args)
      File ''/usr/local/lib/python2.5/site-packages/Pmw/Pmw_1_2/lib/PmwBase.py'', line 1777, in _reporterror
        msg = exc_type + ' Exception in Tk callback\n'
    TypeError: unsupported operand type(s) for +: 'type' and 'str'
    

    到底咋回事儿泥?!

动力源自::txt2tags


::Fri, 27 Apr 2007 10:00 GMT

Sun, 28 May 2006

:: /Zen/pythonic/tryt2t.py

PREFORMATTER_ID = 'txt2tags'
FILE_EXT = 't2t'
__version__ = '$Id: tryt2t.py 299 2006-01-16 09:24:05Z zoomq $'
__author__ = 'Zoom.Quiet <Zoom dot Quiet  at gmail.com>'
#T2T = "/usr/local/bin/txt2tags"
T2T = "t2t"


def cb_entryparser(args):
    args['t2t'] = parse
    #args[FILE_EXT] = readfile
    return args


"""
def parse(filename):
    #html = publish_string(story, writer_name='html')
    import os
    act = T2T+" -t html -H --toc %s"%filename
    html = act
    html += os.popen(act).read().strip()
    #return html[html.find('<body>') + 6:html.find('</body>')]
    return html
"""
#def parse(filename, request):
def parse(filename):
    import os, sys
    from StringIO import StringIO
    # open own source
    #config = request.getConfiguration()
    act = T2T+" -t html -H --toc -o - %s"%filename
    #source = open(filename).read()
    #out = StringIO()

    #html = os.popen(act).read().strip()
    print act
    #print os.popen(act).read().strip()
    # write colorized version to "python.html"
    #Parser(source, out).format(None, None)

    #print out.getvalue()
    """
    entryData = {'body' : out.getvalue(),
                 'title' : filename.replace(config['datadir'], '')}
    return entryData
    """


parse("py-code-rule.t2t")

::Fri, 27 Apr 2007 10:00 GMT
[PyBlosxom]1.4.3 01/10/2008 | [Python] | [FreeBSD] | [Apache]
一切内容使用
Creative Commons License
Creative Commons Attribution-Noncommercial-Share Alike 3.0 License .