NameError: True when using boolean values in jython on wsadmin cli utility

906 Views Asked by At

Writing a jython script for wsadmin, it doesn't seem possible to use boolean values as this simple example shows.

app-stop.py:

isTrue = True
print isTrue

Call:

wsadmin.bat -lang jython -username user -password pw -f D:\app-stop.py

Result:

D:\IBM\WebSphere\AppServer WASX7209I: Connected to process "dmgr" on node OurCellManager using SOAP connector; The type of process is: DeploymentManager WASX7017E: Exception received while running file "D:\app-stop.py"; exception information: com.ibm.bsf.BSFException: exception from Jython: Traceback (innermost last): File "", line 1, in ? NameError: True

It doesn't matter if I'm writing True (which should be valid python) or true. The only way it works is isTrue = 1. But why is it not possible to use valid python code in jython on wsadmin?

1

There are 1 best solutions below

2
On BEST ANSWER

jython in 8.5.5 and earlier is jython 2.1 which implements the language as it was in python 2.1. These constants were not in Python until 2.3.

jython was upgraded in 9.0. This doc describes updating it locally in 8.5.5, but it's surprisingly involved:

https://www.ibm.com/developerworks/websphere/library/techarticles/1207_vansickel/1207_vansickel.html