Compare commits

...

2 Commits

Author SHA1 Message Date
Adam Tauber 239e4da37f
Merge pull request #65 from sumslogs/fix-import-error
Fix: Import error sre_parse
2023-03-07 23:03:57 +00:00
Michael Souza 44712bfb13 Fix: Import error sre_parse
sre_parse module was moved in py3.11
2022-12-10 21:52:13 -08:00
2 changed files with 10 additions and 2 deletions

View File

@ -22,7 +22,11 @@ try:
from future_builtins import map, range from future_builtins import map, range
except: except:
pass pass
from re import match, sre_parse, U from re import match, U
try:
import re._parser as sre_parse
except ImportError: # Python < 3.11
from re import sre_parse
from itertools import tee from itertools import tee
from random import choice, randint from random import choice, randint
from types import GeneratorType from types import GeneratorType

View File

@ -20,8 +20,12 @@
from exrex import generate, count, getone, CATEGORIES, simplify from exrex import generate, count, getone, CATEGORIES, simplify
import re import re
import sre_parse try:
import re._parser as sre_parse
except ImportError: # Python < 3.11
from re import sre_parse
from sys import exit, version_info from sys import exit, version_info
IS_PY3 = version_info[0] == 3 IS_PY3 = version_info[0] == 3
RS = { RS = {