Skip to content Skip to sidebar Skip to footer

Unable To Pass Location Of Input And Output To An Extenal Command Using User-interface In Python

I am completely new to python. I am trying to pass the location of Input and output using User interface as shown in this particular discussion [1]:How to give the location of 'In

Solution 1:

Your cmd is not correct.

Concatenate string with values

cmd = "gpt F:\saikiran\myGraph.xml -Psource=" + input_file + " - Ptarget=" + intermediate_file 

or use string formatting

cmd = "gpt F:\saikiran\myGraph.xml -Psource={} - Ptarget={}".format(input_file, intermediate_file) 

With Python 3.6 or 3.7 you can use f-string

cmd = f"gpt F:\saikiran\myGraph.xml -Psource={input_file} - Ptarget={intermediate_file}"

Current cmd

"gpt F:\saikiran\myGraph.xml -Psource=input_file - Ptarget=intermediate_file"

will create file with name literally

 intermediate_file

not

F:/saikiran/ddd

and it can make problem in gdal.Open()

Post a Comment for "Unable To Pass Location Of Input And Output To An Extenal Command Using User-interface In Python"