When running a piece of Jython code we get the following error:


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 300, in ?
File "<string>", line 137, in generate
File "<string>", line 255, in genModifyMethod
AttributeError: __pos__

Actual Code…


#================================================================
# Create modify method
#================================================================
def genModifyMethod(className):

x = ""
x += newLine
x += indent*2 + "def modify(self):" + newLine
x += indent*3 + 'print "@ClassName@: Modifying attributes: " + self.getAttributes()' + newLine
x += indent*3 + "AdminTask.@ClassName@(self.getAttributes())" + newLine
x += indent*3 + 'print "@ClassName@: Saving configuration after setting new attributes"' + newLine
x += indent*3 + "AdminConfig.save()" + newLine
x += indent*3 + 'print "@ClassName@: COMPLETED SUCCESSFULLY"'; + newLine
x += indent*2 + "#endDef"
x = x.replace("@ClassName@",className)
return x
#endDef

Cause:The reason for this was that we had a line such as

  x += indent*3 + 'print "@ClassName@: COMPLETED SUCCESSFULLY"'; + newLine 

which has a contention after the “;” the solution is to move the “;” before the last single quote.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply