I can't convert a string passed throug command line to a function to float.
I'll explain better. I have this function who takes two arguments, the second one is a float
def function():
first_param = sys.argv[1]
second_param = float(sys.argv[2])
Then I have this other function who calls the first one in a software container
def callFunction(first_arg, second_arg):
cmd = 'docker run --rm -v pathFunction:/home/fenics/shared -w /home/fenics/shared quay.io/fenicsproject/stable "python2 function.py ' + first_arg + str(second_arg)
process = subprocess.Popen(cmd, shell=True)
When I call:
callFunction("some_string",0.02)
it returns me an error in function at the line at whick I try the conversione to float saying: could not convert string to float : shell
UPDATE I've found that the problem is that the first string I'm passing is a path with some spaces in it. Something like: some_string = C:\blabla\my directory\file.txt" with a space between 'my' and 'directory'. I can't change the path, do you know how could I fix it?