Skip to content

Commit

Permalink
Add traceback
Browse files Browse the repository at this point in the history
  • Loading branch information
rajat2004 committed Jan 24, 2020
1 parent 1028961 commit cfc80bb
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions extras/opencv_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import cv2
import pathlib
import traceback, sys

image_name = "github.png"
video_name = "test.mp4"
Expand All @@ -8,10 +9,16 @@

current_dir = str(pathlib.Path(__file__).parent.absolute())

img = cv2.imread(current_dir + "/" + image_name)
if img is not None:
print("Imread successful!")
try:
img = cv2.imread(current_dir + "/" + image_name)
if img is not None:
print("Imread successful!")
except Exception:
traceback.print_exc(file=sys.stdout)

cap = cv2.VideoCapture(current_dir + "/" + video_name)
if cap is not None and cap.isOpened():
print("VideoCapture successful!")
try:
cap = cv2.VideoCapture(current_dir + "/" + video_name)
if cap is not None and cap.isOpened():
print("VideoCapture successful!")
except Exception:
traceback.print_exc(file=sys.stdout)

0 comments on commit cfc80bb

Please sign in to comment.