Newbie at Python and maybe I’m not stating the question right, but how do I cast a passed arg to string in python?
Here is what I’m trying:
#!/usr/bin/python
# Python Wrapper to Call XMLRPC service
import xmlrpclib
import sys
# Set the Server
servAddr = "http://127.0.0.1/xmlrpc.server.php"
# Start the Client
client = xmlrpclib.ServerProxy(servAddr)
for arg in sys.argv:
id = str(arg)
print client.service.setId(id) # Throws long error
# print client.service.setId('123') # Hard coded works
#print arg # prints the id passed
The values from
sys.argvalready are strings. I think the problem is that you are passing sys.argv[0] which is the script name. Try this: