1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Define execfile, file, long, raw_input, xrange for Python 3

This commit is contained in:
cclauss
2018-05-03 09:19:05 +02:00
parent 60e5e213fd
commit 8a79b167b8
6 changed files with 47 additions and 33 deletions
+7 -1
View File
@@ -29,6 +29,12 @@ try:
except NameError:
unicode = lambda s: str(s)
try:
xrange # Python 2
except NameError:
xrange = range # Python 3
if re.search("windows", platform.system(), re.I):
try:
import _winreg
@@ -600,7 +606,7 @@ def template(fileName, svg, replaceme="REPLACEME"):
def load(fileName):
"""Loads an SVG image from a file."""
return load_stream(file(fileName))
return load_stream(open(fileName))
def load_stream(stream):
"""Loads an SVG image from a stream (can be a string or a file object)."""