我无法运行python代码并获取;流程结束,退出代码为1073741819(0xC0000005)";
我是python新手,想运行简单的helloworld程序 这是我的默认值.py我无法运行python代码并获取;流程结束,退出代码为1073741819(0xC0000005)";,python,python-2.7,jvm,Python,Python 2.7,Jvm,我是python新手,想运行简单的helloworld程序 这是我的默认值.py from quickstart import HelloWorld import jpype import os.path asd= os.path.join(os.path.abspath("./"), "lib") jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.ext.dirs=%s" % asd) hw = HelloWorld() hw.main()
from quickstart import HelloWorld
import jpype
import os.path
asd= os.path.join(os.path.abspath("./"), "lib")
jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.ext.dirs=%s" % asd)
hw = HelloWorld()
hw.main()
这是我在init.py中的代码
问题是,当我运行上述代码时,我没有收到任何错误,但程序停止时显示以下消息“进程已完成,退出代码为-1073741819(0xC0000005)”,这是init.py文件中的缩进吗?这是错误的!我很好奇,为什么您要使用Java库,而不是像这样的东西-似乎它不是一个“简单的”hello world!:)是的,我知道,但是没有缩进错误,如果有缩进错误,请告诉我,然后你应该纠正问题中的缩进。我使用java库,因为我想用javabridge运行它
class HelloWorld:
def __init__(self, dataDir):
self.dataDir = dataDir
def main(self):
"""
: The path to the documents directory. :
"""
Document = jpype.JClass("com.aspose.words.Document")
DocumentBuilder = jpype.JClass("com.aspose.words.DocumentBuilder")
doc = Document()
builder = DocumentBuilder(doc)
builder.writeln('Hello World!')
doc.save(self.dataDir +'HelloWorld.docx')