# Gdalbuildvrt dosen't output the vrt file

I am trying to use gdalbuildvrt to create a time series of landsat images. I used the following code but it is not outputting the vrt file.

In the code inlist is the txt file with path to input image. However, if I list the individual tif files itself it would work. Any suggestion on what i am doing wrong?

• Please use text with code formatting (the "{}" button above the question entry text area) not screenshots.. – user2856 May 19 '16 at 23:05

You are getting a return value of 1 - which means an error of some sort.

Try using subprocess.check_output or subprocess.check_call so you get an exception raised if the command fails, you'll get a bit more about why it fails if you do this.

A couple of possible problems:

You are not passing the filepaths, you are passing the literal strings "inlist" and "outVRT". Use inlist and outVRT (note lack of quotes) instead.

Your subprocess call will also fail if gdalbuildvrt isn't located in one of the directories in your PATH environment variable. If that is the reason your command is failing, either pass the full path to gdalbuildvrt, or use os.environ to append the gdalbuildvrt directory to your PATH.

i.e:

subprocess.check_call([r"C:\Path\to\gdalbuildvrt", "-separate", "-input_file_list", inlist, outVRT])


OR

os.environ['PATH'] = ';'.join(r'c:\Path\to\gdal\bin\directory',os.environ['PATH'])
subprocess.check_call([r"gdalbuildvrt", "-separate", "-input_file_list", inlist, outVRT])