Describe the bug
Ocassionally, when stopping commentary, Python will complain about a missing value.
To Reproduce
Steps to reproduce the behavior:
Start commentary
Stop it
See the error happen sometimes, but not all the time
Expected behavior
Obviously shouldn't throw an error; I think there just needs to be a quick sanity check there to see if data is still flowing from iRacing at that point.
Screenshots/Video
N/A
Additional context
Here's the traceback:
Traceback (most recent call last):
File "C:\Users\joshj\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner
self.run()
File "C:\Users\joshj\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\joshj\OneDrive\Documents\Git\IntelliCaster/src\core\director.py", line 291, in run
self._generate_color_commentary()
File "C:\Users\joshj\OneDrive\Documents\Git\IntelliCaster/src\core\director.py", line 94, in _generate_color_commentary
self.commentary.generate(
File "C:\Users\joshj\OneDrive\Documents\Git\IntelliCaster/src\core\commentary.py", line 71, in generate
text = self.text_generator.generate(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\joshj\OneDrive\Documents\Git\IntelliCaster/src\core\commentary.py", line 233, in generate
new_msg += f"The race is at {track} in {city}, {country}. "
^^^^^
UnboundLocalError: cannot access local variable 'track' where it is not associated with a value
Describe the bug Ocassionally, when stopping commentary, Python will complain about a missing value.
To Reproduce Steps to reproduce the behavior:
Expected behavior Obviously shouldn't throw an error; I think there just needs to be a quick sanity check there to see if data is still flowing from iRacing at that point.
Screenshots/Video N/A
Additional context Here's the traceback: