【问题标题】:Eclipse Plugin + Jython - Unhandled event loop exceptionEclipse Plugin + Jython - 未处理的事件循环异常
【发布时间】:2016-03-17 05:50:03
【问题描述】:

以防万一其他人尝试在自构建的 eclipse 插件中使用 Jython。当我尝试通过 interpreter.exec("from myScript import *\n"); 导入我的 python 脚本时,我遭受了 2 天的以下错误:

!ENTRY org.eclipse.ui 4 0 2015-12-11 11:22:53.549
!MESSAGE Unhandled event loop exception
!STACK 0
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/eclipse/luna/../../../common/home/bel/schwinn/lnx/workspace-silecs/silecs-configuration/src/scripts/iecommon.py", line 6, in <module>
    from xml.dom import minidom
  File "/common/home/bel/schwinn/lnx/workspace-silecs/silecs-configuration/target/lib/jython-standalone-2.7.0.jar/Lib/xml/dom/__init__.py", line 226, in <module>
  File "/common/home/bel/schwinn/lnx/workspace-silecs/silecs-configuration/target/lib/jython-standalone-2.7.0.jar/Lib/xml/dom/MessageSource.py", line 19, in <module>
  File "/common/home/bel/schwinn/lnx/workspace-silecs/silecs-configuration/target/lib/jython-standalone-2.7.0.jar/Lib/xml/FtCore.py", line 38, in <module>
  File "/common/home/bel/schwinn/lnx/workspace-silecs/silecs-configuration/target/lib/jython-standalone-2.7.0.jar/Lib/xml/FtCore.py", line 38, in <module>
  File "/common/home/bel/schwinn/lnx/workspace-silecs/silecs-configuration/target/lib/jython-standalone-2.7.0.jar/Lib/gettext.py", line 58, in <module>
  File "/opt/eclipse/luna/../../../common/home/bel/schwinn/lnx/workspace-silecs/silecs-configuration/target/lib/jython-standalone-2.7.0.jar/Lib/posixpath.py", line 77, in join
AttributeError: 'NoneType' object has no attribute 'endswith'

【问题讨论】:

    标签: python eclipse eclipse-plugin jython


    【解决方案1】:

    需要将属性python.home 设置为某个值。看起来哪个值都无关紧要..将其留空是不行的。 设置属性,例如可以在java代码中完成:

        String jythonJarPath = "target/lib/jython-standalone-2.7.0.jar";
        String pythonLibPath = SilecsUtils.findInBundle(jythonJarPath);
        Properties sysProps = System.getProperties();
        sysProps.setProperty("python.path", pythonLibPath + "/Lib");
        sysProps.setProperty("python.home", ".");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多