Jython:子进程模块出错,AttributeError:“module”对象没有属性“python”

2024-05-19 01:43:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我的项目是这样设置的,它从使用PythonInterpreter.initialize方法将python路径设置为jython Lib目录和一个包含“org/quential/neofilis/MyJython files”的目录。然后创建一个PythonInterpreter并让它执行我的主jython文件。在

我想这是非正统的,但它一直在工作,但当我尝试使用Popen时,我遇到了这个错误

File "/home/steven/jython/Lib/subprocess.py", line 1163, in _get_handles
  elif isinstance(stdout, org.python.core.io.RawIOBase):

当我发现这个错误时,我可以复制这个错误

^{pr2}$

但这个没飞

import org

interpreter = org.python.util.PythonInterpreter()
interpreter.exec("print 3+6");
sys.exit(0)

  File "/home/steven/neofelis/src/main/jython/org/curious/neofelis/main.py", line 34, in <module>
    interpreter = org.python.util.PythonInterpreter()
AttributeError: 'module' object has no attribute 'python'

Tags: inpyorg目录homelib错误util
1条回答
网友
1楼 · 发布于 2024-05-19 01:43:41

在这种情况下,导入包org并不总是导入其所有子包和子模块。当您执行import org时,由包来定义将包含哪些内容。显然,默认情况下,python子包不包括在导入中,因此需要显式地导入它。在

相关问题 更多 >

    热门问题