Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f993d28

Browse files
Don't import gl if not needed.
Fixed a typo.
1 parent c9d73d1 commit f993d28

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

Demo/sgi/video/VFile.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818
# Imported modules
1919

2020
import sys
21-
import gl
22-
import GL
21+
try:
22+
import gl
23+
import GL
24+
no_gl = 0
25+
except ImportError:
26+
no_gl = 1
2327
import GET
2428
import colorsys
2529
import imageop
@@ -340,6 +344,9 @@ class Displayer(VideoParams):
340344
# This does not need a current window
341345

342346
def init(self):
347+
if no_gl:
348+
raise RuntimeError, \
349+
'no gl module available, so cannot display'
343350
self = VideoParams.init(self)
344351
# User-settable parameters
345352
self.magnify = 1.0 # frame magnification factor
@@ -377,7 +384,7 @@ def showpartframe(self, data, chromdata, (x,y,w,h)):
377384
if self.upside_down:
378385
gl.pixmode(GL.PM_TTOB, 1)
379386
if self.mirror_image:
380-
gp.pixmode(GL.PM_RTOL, 1)
387+
gl.pixmode(GL.PM_RTOL, 1)
381388
if self.format in ('jpeg', 'jpeggrey'):
382389
import jpeg
383390
data, width, height, bytes = jpeg.decompress(data)

0 commit comments

Comments
 (0)