Hi,
I am using Jython based application and trying to use inspect.py in the python files.
Here is my code
When I execute this using python.exe, there are no issues. However, when I use this inside the Jython app, I've received errors.
I've tried to find info about this error without success.
Any help will be appreciated.
Thanks
Rajasankar
I am using Jython based application and trying to use inspect.py in the python files.
Here is my code
Code:
import inspect,os,sys,pprint,imp
def handle_stackframe_without_leak(getframe):
frame = inspect.currentframe()
try:
function = inspect.getframeinfo(getframe)
print inspect.getargvalues(getframe)
finally:
del frame
#
def raja(a):
handle_stackframe_without_leak(inspect.currentframe())
print a
#
def callraja():
handle_stackframe_without_leak(inspect.currentframe())
raja("raja@ad.com")
#
callraja()
raja("raja@ad.com")
File "C:\Program Files\jython221 ondiffjava\Lib\ inspect.py", line 722, in getframeinfo
File "C:\Program Files\jython221 ondiffjava\Lib\ inspect.py", line 413, in findsource
File "C:\Program Files\jython221 ondiffjava\Lib\ sre.py", line 179, in compile
File "C:\Program Files\jython221 ondiffjava\Lib\ sre.py", line 227, in _compile
File "C:\Program Files\jython221 ondiffjava\Lib\ sre_compile.py" , line 437, in compile
File "C:\Program Files\jython221 ondiffjava\Lib\ sre_compile.py" , line 421, in _code
File "C:\Program Files\jython221 ondiffjava\Lib\ sre_compile.py" , line 143, in _compile
ValueError: ('unsupported operand type', 'branch')
at org.python.core .Py.makeExcepti on(Unknown Source)
at sre_compile$py. _compile$1(C:\P rogram Files\jython221 ondiffjava\Lib\ sre_compile.py: 143)
at sre_compile$py. call_function(C :\Program Files\jython221 ondiffjava\Lib\ sre_compile.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at sre_compile$py. _code$11(C:\Pro gram Files\jython221 ondiffjava\Lib\ sre_compile.py: 421)
at sre_compile$py. call_function(C :\Program Files\jython221 ondiffjava\Lib\ sre_compile.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at sre_compile$py. compile$12(C:\P rogram Files\jython221 ondiffjava\Lib\ sre_compile.py: 437)
at sre_compile$py. call_function(C :\Program Files\jython221 ondiffjava\Lib\ sre_compile.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at org.python.core .PyObject.invok e(Unknown Source)
at sre$py._compile $13(C:\Program Files\jython221 ondiffjava\Lib\ sre.py:227)
at sre$py.call_fun ction(C:\Progra m Files\jython221 ondiffjava\Lib\ sre.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at sre$py.compile$ 8(C:\Program Files\jython221 ondiffjava\Lib\ sre.py:179)
at sre$py.call_fun ction(C:\Progra m Files\jython221 ondiffjava\Lib\ sre.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at org.python.core .PyObject.invok e(Unknown Source)
at inspect$py.find source$24(C:\Pr ogram Files\jython221 ondiffjava\Lib\ inspect.py:413)
at inspect$py.call _function(C:\Pr ogram Files\jython221 ondiffjava\Lib\ inspect.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at inspect$py.getf rameinfo$54(C:\ Program Files\jython221 ondiffjava\Lib\ inspect.py:722)
at inspect$py.call _function(C:\Pr ogram Files\jython221 ondiffjava\Lib\ inspect.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at org.python.core .PyObject.invok e(Unknown Source)
at custom$py.handl e_stackframe_wi thout_leak$4(C: \Program Files\<my app>\jars\custo m.py:29)
at custom$py.call_ function(C:\Pro gram Files\<my app>\.\jars\cus tom.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at definitions$py. gotonotificatio nprofile$122(C: \Program Files\<my app>\.\jars\def initions.py:173 8)
at definitions$py. call_function(C :\Program Files\<my app>\.\jars\def initions.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at notificationcas es$py.A003$2(C: \Program Files\<my app>\.\jars\not ificationcases. py:143)
at notificationcas es$py.call_func tion(C:\Program Files\<my app>\.\jars\not ificationcases. py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at org.python.pyco de._pyx171.f$0( 003:8)
at org.python.pyco de._pyx171.call _function(003)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyCode.call(Un known Source)
at org.python.core .Py.runCode(Unk nown Source)
at org.python.util .PythonInterpre ter.execfile(Un known Source)
File "C:\Program Files\jython221 ondiffjava\Lib\ inspect.py", line 413, in findsource
File "C:\Program Files\jython221 ondiffjava\Lib\ sre.py", line 179, in compile
File "C:\Program Files\jython221 ondiffjava\Lib\ sre.py", line 227, in _compile
File "C:\Program Files\jython221 ondiffjava\Lib\ sre_compile.py" , line 437, in compile
File "C:\Program Files\jython221 ondiffjava\Lib\ sre_compile.py" , line 421, in _code
File "C:\Program Files\jython221 ondiffjava\Lib\ sre_compile.py" , line 143, in _compile
ValueError: ('unsupported operand type', 'branch')
at org.python.core .Py.makeExcepti on(Unknown Source)
at sre_compile$py. _compile$1(C:\P rogram Files\jython221 ondiffjava\Lib\ sre_compile.py: 143)
at sre_compile$py. call_function(C :\Program Files\jython221 ondiffjava\Lib\ sre_compile.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at sre_compile$py. _code$11(C:\Pro gram Files\jython221 ondiffjava\Lib\ sre_compile.py: 421)
at sre_compile$py. call_function(C :\Program Files\jython221 ondiffjava\Lib\ sre_compile.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at sre_compile$py. compile$12(C:\P rogram Files\jython221 ondiffjava\Lib\ sre_compile.py: 437)
at sre_compile$py. call_function(C :\Program Files\jython221 ondiffjava\Lib\ sre_compile.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at org.python.core .PyObject.invok e(Unknown Source)
at sre$py._compile $13(C:\Program Files\jython221 ondiffjava\Lib\ sre.py:227)
at sre$py.call_fun ction(C:\Progra m Files\jython221 ondiffjava\Lib\ sre.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at sre$py.compile$ 8(C:\Program Files\jython221 ondiffjava\Lib\ sre.py:179)
at sre$py.call_fun ction(C:\Progra m Files\jython221 ondiffjava\Lib\ sre.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at org.python.core .PyObject.invok e(Unknown Source)
at inspect$py.find source$24(C:\Pr ogram Files\jython221 ondiffjava\Lib\ inspect.py:413)
at inspect$py.call _function(C:\Pr ogram Files\jython221 ondiffjava\Lib\ inspect.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at inspect$py.getf rameinfo$54(C:\ Program Files\jython221 ondiffjava\Lib\ inspect.py:722)
at inspect$py.call _function(C:\Pr ogram Files\jython221 ondiffjava\Lib\ inspect.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at org.python.core .PyObject.invok e(Unknown Source)
at custom$py.handl e_stackframe_wi thout_leak$4(C: \Program Files\<my app>\jars\custo m.py:29)
at custom$py.call_ function(C:\Pro gram Files\<my app>\.\jars\cus tom.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at definitions$py. gotonotificatio nprofile$122(C: \Program Files\<my app>\.\jars\def initions.py:173 8)
at definitions$py. call_function(C :\Program Files\<my app>\.\jars\def initions.py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at notificationcas es$py.A003$2(C: \Program Files\<my app>\.\jars\not ificationcases. py:143)
at notificationcas es$py.call_func tion(C:\Program Files\<my app>\.\jars\not ificationcases. py)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyFunction.__c all__(Unknown Source)
at org.python.pyco de._pyx171.f$0( 003:8)
at org.python.pyco de._pyx171.call _function(003)
at org.python.core .PyTableCode.ca ll(Unknown Source)
at org.python.core .PyCode.call(Un known Source)
at org.python.core .Py.runCode(Unk nown Source)
at org.python.util .PythonInterpre ter.execfile(Un known Source)
Any help will be appreciated.
Thanks
Rajasankar