CodeLabClub / codelab_adapter_extensions

codelab_adapter extensions
GNU General Public License v3.0
143 stars 72 forks source link

在windows下运行python-kernel-extension错误 #42

Closed LCBProgHome closed 4 years ago

LCBProgHome commented 4 years ago

2020-02-24 20:32:38.229 | INFO | extension_python_kernel:extension_message_handle:62 - python code: print('hello') 2020-02-24 20:32:38.229 | DEBUG | codelab_adapter_client.base:publish:276 - adapter/nodes/PythonKernelExtension publish: topic: adapter/extensions/data payload:{'extension_id': 'eim/python', 'content': "'NoneType' object is not subscriptable", 'message_id': 1, 'token': 'b54d29ae21294fc7', 'sender': 'from_scratch'}

wwj718 commented 4 years ago

看起来是前端发过来的信息有误,scratch前端是怎样的呢

LCBProgHome commented 4 years ago

前端就是一个 广播 print('hello') 并等待 使用extension_python_kernel_exec插件正常,是不是extension_python_kernel中的下面这段代码限制了只能使用PyHelper中的函数。 output = eval(code, {"__builtins__": None}, { "PyHelper": self.PyHelper, })

wwj718 commented 4 years ago

是的,只能运行常规求值表达式和PyHelper,如果需要完整功能则使用extension_python_kernel_exec。但extension_python_kernel_exec有风险

wwj718 commented 4 years ago

如果需要平衡功能和安全性,建议通过扩展 { "PyHelper": self.PyHelper, }