Knowledgebase

Reference: Python Problems and Where to Look Print

  • python, troubleshooting, errors, cron, performance, guide, howto, solution
  • 0

Quick lookup.

SCRIPT WILL NOT RUN AT ALL

Syntax error, or the wrong interpreter. Read the first error.

INDENTATION ERROR

Mixed tabs and spaces. Configure the editor for spaces.

MODULE NOT FOUND

Not installed, installed elsewhere, or the virtual environment is not active.

Also: a file named after the library, shadowing it.

WORKS IN THE TERMINAL, FAILS UNDER CRON

Paths and environment. Use full paths and set what the script needs.

WORKS LOCALLY, FAILS ON THE SERVER

Python version, dependency versions, missing environment variable, or a path assumption.

CHANGES NOT TAKING EFFECT

The application was not restarted.

UNEXPECTED VALUE

Print the value and its type. It is frequently text where a number was assumed.

KEY OR INDEX ERROR

The data is not the shape assumed. Validate it.

SLOW ON REAL DATA, FINE ON SAMPLES

Nested loops, repeated searching, or per-item queries.

MEMORY ERROR OR UNEXPECTED RESTART

Everything loaded into memory, or something accumulating.

INTERMITTENT FAILURE

Timing, external service, or overlapping scheduled runs.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot