ipython-exec vs execute-script

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!!!

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容