Hello All,
I am new to Python and generally struggle with even simple scripts.
I have a list of images in different directories.
I want to reproject them bulk using python.
So first, I tried to open the file and then use the readlines in hope that all the records in the text filr will be processed one by one.
with open(r'X:\Archive\1930_1949\CA\Index\List_Zone_10.txt', 'r')as listFiles:
inputRasters = listFiles.readlines()[0]
print inputRasters
outPath = arcpy.env.workspace
inputFilenames = os.path.splitext(os.path.basename(inputRasters))[0]
print inputFilenames
outPut = os.path.join(outPath, os.path.basename(inputFilenames)+ ".jp2")
print outPut
print ''
arcpy.ProjectRaster_management(inputRasters, outPut, prj)
The result is that I get only one ouput as below:
>>> ================================ RESTART ================================
>>>
X:\Archive\1930_1949\CA\Alameda\1939_08_22_12_301.tif
1939_08_22_12_301
X:\Archive\1930_1949\CA\JP2\1939_08_22_12_301.jp2
>>>
Is there any way I can get the multiple files to be processed?
I am new to Python and generally struggle with even simple scripts.
I have a list of images in different directories.
I want to reproject them bulk using python.
So first, I tried to open the file and then use the readlines in hope that all the records in the text filr will be processed one by one.
with open(r'X:\Archive\1930_1949\CA\Index\List_Zone_10.txt', 'r')as listFiles:
inputRasters = listFiles.readlines()[0]
print inputRasters
outPath = arcpy.env.workspace
inputFilenames = os.path.splitext(os.path.basename(inputRasters))[0]
print inputFilenames
outPut = os.path.join(outPath, os.path.basename(inputFilenames)+ ".jp2")
print outPut
print ''
arcpy.ProjectRaster_management(inputRasters, outPut, prj)
The result is that I get only one ouput as below:
>>> ================================ RESTART ================================
>>>
X:\Archive\1930_1949\CA\Alameda\1939_08_22_12_301.tif
1939_08_22_12_301
X:\Archive\1930_1949\CA\JP2\1939_08_22_12_301.jp2
>>>
Is there any way I can get the multiple files to be processed?