Question

The TIF.gz file downloaded from the link below can be successfully extracted by WinRAR GUI mode manually.

ftp://ftp.glcf.umd.edu/glcf/QuickBird/02AUG15032744-X2AS_R1C1-000000185959_01_P005-Indonesia-Ujong/02AUG15032744-M2AS_R1C1-000000185959_01_P005.TIF.gz

However, it could not extract using programming mode using Python. But the similiar method below can extract other tar.gz files:

import subprocess
win_rar = 'C:\\Program Files\\WinRAR\\UnRAR.exe'
tif_gz_file = 'D:\\source\\02AUG15032744-M2AS_R1C1-000000185959_01_P005.TIF.gz'
subprocess.call([win_rar, 'x', tif_gz_file, 'D:\\target\\'])

Any idea would be highly appreciated. I also tried the similiar procesure using 7-Zip, it also did not. I want to extract it using a program. Please help me.

Was it helpful?

Solution

You need to change this:

win_rar = 'C:\\Program Files\\WinRAR\\UnRAR.exe'

to this:

win_rar = 'C:\\Program Files\\WinRAR\\WinRAR.exe'

I ran your code successfully with this change (after reproducing your error).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top