Skip to content

Commit 68cde06

Browse files
authored
Merge pull request #91 from Jendker/pr
Make script python3 compatible
2 parents 3c172cf + dd686bb commit 68cde06

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

scripts/test_video_resource.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919

2020
if __name__ == '__main__':
2121
if len(sys.argv) < 2:
22-
print "You must give an argument to open a video stream."
23-
print " It can be a number as video device, e.g.: 0 would be /dev/video0"
24-
print " It can be a url of a stream, e.g.: rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"
25-
print " It can be a video file, e.g.: myvideo.mkv"
22+
print("You must give an argument to open a video stream.")
23+
print(" It can be a number as video device, e.g.: 0 would be /dev/video0")
24+
print(" It can be a url of a stream, e.g.: rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov")
25+
print(" It can be a video file, e.g.: myvideo.mkv")
2626
exit(0)
2727

2828
resource = sys.argv[1]
@@ -32,14 +32,14 @@
3232
resource = int(resource)
3333
else:
3434
resource_name = resource
35-
print "Trying to open resource: " + resource_name
35+
print("Trying to open resource: ", resource_name)
3636
cap = cv2.VideoCapture(resource)
3737
if not cap.isOpened():
38-
print "Error opening resource: " + str(resource)
39-
print "Maybe opencv VideoCapture can't open it"
38+
print("Error opening resource: " + str(resource))
39+
print("Maybe opencv VideoCapture can't open it")
4040
exit(0)
4141

42-
print "Correctly opened resource, starting to show feed."
42+
print("Correctly opened resource, starting to show feed.")
4343
rval, frame = cap.read()
4444
while rval:
4545
cv2.imshow("Stream: " + resource_name, frame)
@@ -50,4 +50,3 @@
5050
if key == 27 or key == 1048603:
5151
break
5252
cv2.destroyWindow("preview")
53-

0 commit comments

Comments
 (0)