我正在为PyCharm编写一个plugin,它在您编辑Python代码时运行Python代码,并显示所有变量值、循环迭代和其他状态
它工作得很好,但编辑作为插件项目一部分的Python代码却很尴尬。对内置函数的任何调用都会显示如下检查错误:
Unresolved reference: 'sum'
如果我在我的插件项目中设置了Python解释器,那么所有检查错误都会消失,但是我的插件zip文件现在包含了所有系统Python库,当我尝试从插件运行Python脚本时,会出现以下错误:
Failed to import the site module
Traceback (most recent call last):
File "/home/don/.IdeaIC2017.1/system/plugins-sandbox/plugins/livepy/classes/site.py", line 78, in <module>
import os
File "/home/don/.IdeaIC2017.1/system/plugins-sandbox/plugins/livepy/classes/os/__init__.py", line 7, in <module>
import subprocess
File "/home/don/.IdeaIC2017.1/system/plugins-sandbox/plugins/livepy/classes/subprocess.py", line 830, in <module>
class Popen(object):
File "/home/don/.IdeaIC2017.1/system/plugins-sandbox/plugins/livepy/classes/subprocess.py", line 1555, in Popen
def _handle_exitstatus(self, sts, _WIFSIGNALED=os.WIFSIGNALED,
AttributeError: module 'os' has no attribute 'WIFSIGNALED'
如何在插件项目中编辑Python代码而不出现上面列出的问题?我选中了,并且Python库没有在项目结构对话框中标记为导出。下面是设置Python解释器后的项目文件:
Python配置现在已经设置了sdkName,最后一个orderEntry是新的
在项目结构:Modules:Dependenciestab中,我找到了所需的设置。如果我将Python库的作用域设置为“Provided”,那么它就不会包含在插件jar文件中
相关问题 更多 >
编程相关推荐