kisa wrote: ↑Tue Feb 07, 2023 6:35 pm
Broken on windows with the same error as ThrashNeon is getting
@kisa
Just a heads up... I managed to get this working on the latest version of Ren'Py.
In "example_code.rpy" at line 561 you'll see this section:
Code: Select all
# A list of files we will be scanning.
files = [ ]
for i in os.listdir(config.gamedir):
if i.endswith(".rpy"):
files.append(os.path.join(config.gamedir, i))
for fn in files:
f = file(fn, "r")
open_examples = set()
for l in f:
l = l.decode("utf-8")
l = l.rstrip()
m = re.match("\s*#begin (\w+)", l)
if m:
example = m.group(1)
if example in examples:
raise Exception("Example %r is defined in two places.", example)
open_examples.add(example)
examples[example] = [ ]
continue
m = re.match("\s*#end (\w+)", l)
if m:
example = m.group(1)
if example not in open_examples:
raise Exception("Example %r is not open.", example)
open_examples.remove(example)
continue
for i in open_examples:
examples[i].append(l)
if open_examples:
raise Exception("Examples %r remain open at the end of %r" % (open_examples, fn))
f.close()
... you want to replace it with this:
Code: Select all
# A list of files we will be scanning.
for filename in renpy.list_files():
if filename.endswith(".rpy"):
f = renpy.file(filename)
open_examples = set()
for l in f:
l = l.decode("utf-8")
l = l.rstrip()
m = re.match("\s*#begin (\w+)", l)
if m:
example = m.group(1)
if example in examples:
raise Exception("Example %r is defined in two places.", example)
open_examples.add(example)
examples[example] = [ ]
continue
m = re.match("\s*#end (\w+)", l)
if m:
example = m.group(1)
if example not in open_examples:
raise Exception("Example %r is not open.", example)
open_examples.remove(example)
continue
for i in open_examples:
examples[i].append(l)
if open_examples:
raise Exception("Examples %r remain open at the end of %r" % (open_examples, fn))
f.close()
I got rid of the os.listdir() and files.append() functions altogether, and just used renpy.list_files() instead.
Please note: This change has some changes to the indentation, so copy and paste carefully to replace the entire section.