Hi all, first post so hopefully I'm in the correct place.

I'm new to python/jython and am currently trying to write a hot-deploy script, in short its working, however I am now making it for mulitple applications. I'm really struggling to get the path to a JAR archive into a list. I have a property file that contains the following:


In python I am creating a list and trying to append it with the .path part of the property file. I know these values are working because I can bind them into a string and print it to the screen. I can also hardcode the path into a string and that imports into the list as well. However with the following it falls over with a " TypeError: __add__ nor __radd__ defined for these operands" error.

def unDeployApps():
    for unApp in unApps.keys():
# Test to prove list is ok
        print unDepSuccess
# This also prints the correct path
        print "Printing strTest " + strTest
        print "Adding strTest to Array " + `unDepSuccess`
# This is where is falls over
        print "Printing unDepSuccess " + unDepSuccess

Screen output:

[java] Printing strTest /opt/app/stage/dsb-apps/02-console.ear
[java] Adding strTest to Array
[java] File "/opt/app/stage/redeployment/redeploy.py", line 136, in ?
[java] File "/opt/app/stage/redeployment/redeploy.py", line 69, in unDeployApps
[java] TypeError: __add__ nor __radd__ defined for these operands

I'm probably making a very basic error somewhere but if anyone can point me in the right direction it'd be appreciated.

Many thanks, hopefully I can feed back into this forum when I actually know what I'm doing :)


I'm sorry to hear that you have to work with Jython. My condolences. That being said, why don't you insert a print type(strTest) to see if it's actually being presented as a string.

Thanks, it seems it is:

[java] org.python.core.PyString

I've heard it a complete pain in the backside, have had a couple of good java devs look at it with me as well :)

TypeError: __add__ nor __radd__ defined for these operands

The error could be here because of backticks
print "Adding strTest to Array " + `unDepSuccess`
Also, you can not concatenate a string and a list (I'm assuming it is a list because you append to it).
print "Printing unDepSuccess " + unDepSuccess
print "Adding strTest to Array " + `unDepSuccess`

print "Printing unDepSuccess ", unDepSuccess