When running a Jython script I get the following error, the reason is because part of my code is not equating correctly.


WASX7017E: Exception received while running file "C:/scripts/gen.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 298, in ?
File "<string>", line 137, in generate
TypeError: __add__ nor __radd__ defined for these operands

Solution: A common example is when you are assigning the result of a function all to a variable, however you function is not returning a value. Sometime this can be easily done because you forget the “return” statement.

For example:

Here is a function

Here is the main code routine calling the function

Because the “genModifyMethod” function is not returning a value, we are trying to assign to function that does not return a value  and so we get an error such as “TypeError: __add__ nor __radd__ defined for these operands

the fix is to add

to my function for example:

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply