Skip to content

Commit 679be53

Browse files
authored
Update cli.py (#132)
* Update cli.py readfp is not available in Python 3.12. * Update cli.py Support Python 2 as well as Python 3.12+
1 parent 7035125 commit 679be53

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

jinja2cli/cli.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ def as_dict(self):
131131
return d
132132

133133
p = MyConfigParser()
134-
p.readfp(StringIO(data))
134+
try:
135+
reader = p.readfp
136+
except AttributeError:
137+
reader = p.read_file
138+
reader(StringIO(data))
135139
return p.as_dict()
136140

137141
return _parse_ini, ConfigParser.Error, MalformedINI

0 commit comments

Comments
 (0)