fuckingpython.lol

Python errors › What is new

New error messages in Python 3.13

Updated

Python 3.13 made tracebacks colourful and taught the interpreter to recognise one of the most confusing mistakes: a script named like the module it imports. Each example below ran on 3.12 and on 3.13.

Colour in tracebacks

In a terminal, tracebacks are now in colour by default. The PYTHON_COLORS environment variable switches it, and the cross-tool NO_COLOR and FORCE_COLOR variables are honoured. Output sent to a file or a pipe stays plain, which is why the runs on this page have no colour.

A script named like a standard library module

random.py
import random

print(random.randint(1, 6))
Python 3.13 prints
Traceback (most recent call last):
  File "/home/me/project/random.py", line 1, in <module>
    import random
  File "/home/me/project/random.py", line 3, in <module>
    print(random.randint(1, 6))
          ^^^^^^^^^^^^^^
AttributeError: module 'random' has no attribute 'randint' (consider renaming '/home/me/project/random.py' since it has the same name as the standard library module named 'random' and prevents importing that standard library module)
PythonPrints
3.12AttributeError: partially initialized module 'random' has no attribute 'randint' (most likely due to a circular import)
3.13AttributeError: module 'random' has no attribute 'randint' (consider renaming '/home/me/project/random.py' since it has the same name as the standard library module named 'random' and prevents importing that standard library module)

Run on CPython 3.12.15 and 3.13.17, on October 25, 2026.

A script named like a library you meant to import

numpy.py
import numpy as np

print(np.array([1, 2, 3]))
Python 3.13 prints
Traceback (most recent call last):
  File "/home/me/project/numpy.py", line 1, in <module>
    import numpy as np
  File "/home/me/project/numpy.py", line 3, in <module>
    print(np.array([1, 2, 3]))
          ^^^^^^^^
AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/home/me/project/numpy.py' if it has the same name as a library you intended to import)
PythonPrints
3.12AttributeError: partially initialized module 'numpy' has no attribute 'array' (most likely due to a circular import)
3.13AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/home/me/project/numpy.py' if it has the same name as a library you intended to import)

Run on CPython 3.12.15 and 3.13.17, on October 25, 2026.

Suggestions for keyword arguments

A misspelt keyword argument gets the closest real parameter name.

main.py
print("Better error messages!".split(max_split=1))
Python 3.13 prints
Traceback (most recent call last):
  File "/home/me/project/main.py", line 1, in <module>
    print("Better error messages!".split(max_split=1))
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
TypeError: split() got an unexpected keyword argument 'max_split'. Did you mean 'maxsplit'?
PythonPrints
3.12TypeError: 'max_split' is an invalid keyword argument for split()
3.13TypeError: split() got an unexpected keyword argument 'max_split'. Did you mean 'maxsplit'?

Run on CPython 3.12.15 and 3.13.17, on October 25, 2026.

Sources

Read on October 25, 2026.