Fix idle3 not dealing with Python3.13 interpreter colors

A minimal IDLE3 session in Fedora 41:

Python 3.13.0 (main, Oct  8 2024, 00:00:00) [GCC 14.2.1 20240912 (Red Hat 14.2.1-3)] on linux
Type "help", "copyright", "credits" or "license()" for more information.
os.path
Traceback (most recent call last):
  File e[35m"/usr/lib64/python3.13/idlelib/run.py"e[0m, line e[35m590e[0m, in e[35mruncodee[0m
    e[31mexece[0me[1;31m(code, self.locals)e[0m
    e[31m~~~~e[0me[1;31m^^^^^^^^^^^^^^^^^^^e[0m
  File e[35m"<pyshell#0>"e[0m, line e[35m1e[0m, in e[35m<module>e[0m
e[1;35mNameErrore[0m: e[35mname 'os' is not defined. Did you forget to import 'os'?e[0m

The problem is the new interactive interpreter colors in Python3.13, which idle3 doesn’t seem to be prepared to handle.

My quick fix for this right now is to modify the idle3 .desktop file to disable PYTHON_COLORS with:
Exec=env PYTHON_COLORS=0 idle3 %F

This or sth similar should probably be done in F41 by default.

From Proposed Common Issues to Ask Fedora

You should report this in the fedora bug-tracker so that the right people get to see the issue.

1 Like