Jython and Websphere wsadmin escape issue
===

I have problem setting namespace binding properties from Jython using wsadmin. 
I read properties from xyz.properties file and set those values to websphere 
Problem occurs when my .properties file contains special characters like ], [, ", ' 

Example xyz.properties 

vlada2=asd'" 
vlada3=asd[ 

> WASX7017E: Exception received while running file "blabla.py";
> exception information: java.lang.IllegalArgumentException: 
> 
> java.lang.IllegalArgumentException: WASX7122E: Expected "]"  not
> found. 
> 
> Attribute=stringToBind had invalid value=asd\ for input
> parameter=[stringToBind asd\'"] [nameInNameSpace "vlada1"] [name
> "vlada1"]

**Script source code** 

    def setWebSphereNamespaceBindings(key, value, nodeName, serverName): 
            parent = AdminConfig.getid("/Node:"+nodeName+"/Server:"+serverName+"/") 
             
            attrs=[["name", key], ["nameInNameSpace", key], ["stringToBind", [value]]] 
             
            #Find Configuration Object 
            cfgObj = AdminConfig.getid("/Node:"+nodeName+"/Server:"+serverName+"/StringNameSpaceBinding:" + key + "/") 
             
            if cfgObj: 
                    AdminConfig.modify(cfgObj, attrs) 
                    #AdminConfig.save() 
                    print "Namespace binding updated/modified: " + cfgObj 
            else: 
                    cfgObj = AdminConfig.create("StringNameSpaceBinding", parent, attrs) 
                    #AdminConfig.save() 
                    print "Namespace binding created: " + cfgObj 
        

    import java.util as util 
    import java.io as javaio 
    import string 
    
    props = util.Properties() 
    propfile_name="bindings.properties" 
    inside = props.load(javaio.FileInputStream(propfile_name)) 
    
    nodeName = AdminControl.getNode() 
    cellName = AdminControl.getCell() 
    
    objNameString = AdminControl.completeObjectName("WebSphere:type=Server,*") 
    serverName = AdminControl.getAttribute(objNameString, "name") 
    scope = AdminConfig.getid("/Node:"+nodeName+"/Server:"+serverName+"/") 
    
    for key in props.keySet().iterator(): 
            value = props.getProperty(key) 
            setWebSphereNamespaceBindings(key, value, nodeName, serverName) 
    
    AdminConfig.save() 