All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bugtests.test401.py Maven / Gradle / Ivy

Go to download

Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.

There is a newer version: 2.7.4
Show newest version
# 
# Test for bug 1758838
#
# execfile() should not throw a NullPointerException
#
# The error only shows up in interactive interpretation (type "single" for the compilation).
# But we cannot use InteractiveInterpreter here since it catches all Exceptions,
# therefore we do the compilation 'by hand'.
#

from org.python.core import Py
from org.python.core import PySystemState
from org.python.util import PythonInterpreter

PySystemState.initialize()
interp = PythonInterpreter()
code = Py.compile_command_flags("execfile('test401/to_be_executed.py')", "", "single", None, 1)
interp.exec(code)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy