文学化编程LEO

ipython-exec vs execute-script

2017-04-05  本文已影响21人  swotpp

execute-script

执行这个命令需要下面的内容

@first #! /usr/bin/env python
@first # -*- coding: utf-8 -*-
@language python
@tabwidth -4
@others

ipython-exec

不能加 utf-8,否则会报错

Traceback (most recent call last):
File "/home/swot/leo/leo/plugins/qt_events.py", line 128, in eventFilter
k.masterKeyHandler(event)
File "/home/swot/leo/leo/core/leoKeys.py", line 3253, in masterKeyHandler
done = k.doMode(event, state, stroke)
File "/home/swot/leo/leo/core/leoKeys.py", line 3365, in doMode
handler(event)
File "/home/swot/leo/leo/core/leoKeys.py", line 2815, in repeatComplexCommandHelper
c.commandsDictlast
File "/home/swot/leo/leo/plugins/qt_gui.py", line 1051, in ipython_exec_f
g.app.ipk.run_script(file_name=c.p.h,script=script)
File "/home/swot/leo/leo/core/leoIPython.py", line 203, in run_script
code = compile(script, file_name, 'exec')
File "get access token --- execute-script", line 0
SyntaxError: encoding declaration in Unicode stringreading settings in /home/swot/.leo/workbook.leo

解决方法:

同时存在的解决方法,即将执行 execute-script 的 node 作为 ipython-exec的父 node,这样就可以选择不同的 node 去执行不同的命令了。Great!!!

上一篇 下一篇

猜你喜欢

热点阅读