I'm attempting to throw an exception in Ren'Py using the same method as DDLC. This, as far as I can tell, is done by calling report_exception in renpy.error like this:
python:
try:
sys.modules['renpy.error'].report_exception("This is an error.", True)
except:
pass
Running this results in nothing happening. However, when I attempt to run the line without the try/except, I get an error:
Traceback (most recent call last):
File "renpy/common/00console.rpy", line 705, in run
result = renpy.python.py_eval(code)
File "D:\Users\Real_User\Documents\RenPy\renpy-8.0.3-sdk\renpy\python.py", line 1092, in py_eval
return py_eval_bytecode(code, globals, locals)
File "D:\Users\Real_User\Documents\RenPy\renpy-8.0.3-sdk\renpy\python.py", line 1085, in py_eval_bytecode
return eval(bytecode, globals, locals)
File "<none>", line 1, in <module>
File "D:\Users\Real_User\Documents\RenPy\renpy-8.0.3-sdk\renpy\error.py", line 184, in report_exception
print(type.__name__ + ":", end=' ', file=simple)
AttributeError: 'NoneType' object has no attribute '__name__'
Looking in Ren'Py's error.py shows that this 'NoneType' object is from this line:
print(type.__name__ + ":", end=' ', file=simple)
and that type is mentioned only once before, in this line:
type, _value, tb = sys.exc_info() # @ReservedAssignment
Is there any way to fix this?