Skip to content

Commit 15c88be

Browse files
committed
fix lack of exception handling in subprocess
1 parent d11b546 commit 15c88be

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Scripts/Miscellaneous/Unwrap_video/unwrap.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
#only process videos, ignore generated images
77
if not 'jpeg' in video:
88
#get video resolution
9-
result = subprocess.run(['ffprobe', '-v', 'error', '-select_streams', 'v:0', '-show_entries', 'stream=width,height', '-of', 'csv=s=,:p=0', video], stdout=subprocess.PIPE)
9+
try:
10+
result = subprocess.run(['ffprobe', '-v', 'error', '-select_streams', 'v:0', '-show_entries', 'stream=width,height', '-of', 'csv=s=,:p=0', video], stdout=subprocess.PIPE)
11+
except Exception:
12+
print('Error running ffprobe.')
13+
sys.exit()
14+
1015
resolution = result.stdout.decode('utf-8')
1116
height,width = resolution.split(',')
1217
height = int(height)

0 commit comments

Comments
 (0)