Fruit-Jam-OS/builtin_apps/PyBasic/PyBasic changes.txt
2025-08-06 23:31:17 -04:00

22 lines
767 B
Text

Changes made to https://github.com/richpl/PyBasic on 8/6/2025 to support CircuitPython and Fruit-Jam-OS.
1) interpreter.py (modified printing of trapped exceptions for CircuitPython):
Added the following import (line 30):
from traceback import print_exception
Replaced exception print (line 130):
Orig: print(e, file=stderr, flush=True)
New: print_exception(e,e,e.__traceback__ if hasattr(e,'__traceback__') else None)
2) program.py (set the default directory to the same directory a program is loaded from):
Added the following import (line 28):
import os
Added command to set current directory to folder loaded program is loaded from (line 236-239):
if file.rfind('/') == 0:
os.chdir('/')
elif file.rfind('/') != -1:
os.chdir(file[:file.rfind('/')])