1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Drop Python2 support.

This commit is contained in:
Alexander Smorkalov
2023-07-13 16:07:10 +03:00
parent cea26341a5
commit 1a3523d2d8
51 changed files with 65 additions and 344 deletions
+8 -22
View File
@@ -4,8 +4,6 @@
Sample-launcher application.
'''
# Python 2/3 compatibility
from __future__ import print_function
import sys
# local modules
@@ -16,13 +14,8 @@ import webbrowser
from glob import glob
from subprocess import Popen
try:
import tkinter as tk # Python 3
from tkinter.scrolledtext import ScrolledText
except ImportError:
import Tkinter as tk # Python 2
from ScrolledText import ScrolledText
import tkinter as tk
from tkinter.scrolledtext import ScrolledText
#from IPython.Shell import IPShellEmbed
#ipshell = IPShellEmbed()
@@ -117,19 +110,12 @@ class App:
descr = ""
try:
if sys.version_info[0] > 2:
# Python 3.x
module_globals = {}
module_locals = {}
with open(fn, 'r') as f:
module_code = f.read()
exec(compile(module_code, fn, 'exec'), module_globals, module_locals)
descr = module_locals.get('__doc__', 'no-description')
else:
# Python 2
module_globals = {}
execfile(fn, module_globals) # noqa: F821
descr = module_globals.get('__doc__', 'no-description')
module_globals = {}
module_locals = {}
with open(fn, 'r') as f:
module_code = f.read()
exec(compile(module_code, fn, 'exec'), module_globals, module_locals)
descr = module_locals.get('__doc__', 'no-description')
except Exception as e:
descr = str(e)