Llistat d’errors comuns a Python¶

  • AttributeError
    • AttributeError: XXX object has no attribute YYY
  • FileNotFoundError
    • FileNotFoundError: [Errno 2] No such file or directory: XXX
  • ImportError
    • ImportError: No module named XXX
  • IndentationError
    • IndentationError: expected an indented block
    • IndentationError: unexpected indent
    • IndentationError: unindent does not match any outer indentation level
  • IndexError
    • IndexError: XXX index out of range
  • KeyError
    • KeyError: XXX
  • NameError
    • NameError: name XXX is not defined
  • SyntaxError
    • SyntaxError: invalid syntax
    • SyntaxError: EOL while scanning string literal
    • SyntaxError: EOF while scanning triple-quoted string literal
  • TypeError
    • TypeError: Can’t convert XXX object to str implicitly
    • TypeError: unorderable types: XXX > YYY
    • TypeError: can only concatenate XXX (not YYY) to XXX
    • TypeError: XXX indices must be integers, not YYY
    • TypeError: unsupported operand type(s) for XXX: YYY and ZZZ
    • TypeError: bad operand type for unary XXX: YYY
    • TypeError: XXX object is not subscriptable
    • TypeError: XXX missing YYY required positional argument: ZZZ
    • TypeError: XXX object cannot be interpreted as an YYY
    • TypeError: unhashable type: XXX
  • UnboundLocalError
    • UnboundLocalError: local variable xxx referenced before assignment
  • ValueError
    • ValueError: could not convert XXX to YYY: ZZZ
    • ValueError: invalid literal for int() with base 10: XXX
    • ValueError: math domain error

Logo of Informàtica

Informàtica

Navegació

  • Temari i exercicis
  • Exàmens
  • Bibliografia
  • Glossari
  • Introducció al laboratori
  • Llistat d’errors comuns a Python
  • Guia ràpida d’IDLE
  • Tests de funcions. Doctest
  • Programari
  • Preguntes frequents sobre els exàmens
  • La correcció d’exàmens amb doctest
  • Instruccions per als exàmens
  • Recomanacions per fer servir xats d’IA al curs

Related Topics

  • Documentation overview
    • Previous: Practicar amb l’intèrpret d’ordres
    • Next: AttributeError

Cerca ràpida

©2015-2025, Professorat de l'ETSEIB del departament de Ciències de la Computació de la UPC. Publicat sota la llicència Reconeixement-CompartirIgual 4.0 Internacional de Creative Commons. | Powered by Sphinx 8.1.3 & Alabaster 1.0.0 | Page source