Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Use your computer’s scheduler to launch Python once a day: Task Scheduler on Windows, launchd on macOS, or cron or a systemd timer on Linux. The scheduler starts the Python interpreter; Python then runs your script. Use the absolute path to the interpreter in your project’s virtual environment, set the working directory, and capture logs.
For example, a Linux or macOS command looks like /path/to/project/.venv/bin/python /path/to/project/script.py. On Windows, use C:pathtoproject.venvScriptspython.exe followed by the script path. Avoid relying on python script.py: scheduled tasks often have a different PATH, working directory, account, and environment from your terminal.
Choose where and when the job should run
First decide what “every day” means for your task:
- At a fixed local time: for example, every day at 9 a.m.
- Every 24 hours: a rolling interval that may drift from a particular clock time.
- After a missed run: useful if a laptop is off or asleep at the scheduled time, but behavior depends on the scheduler and its configuration.
- Only on weekdays: a different schedule from every calendar day.
Also choose the time zone. Local schedulers generally use the machine’s configuration, while cloud services may use UTC or let you select a zone. Render cron schedules use UTC; Google Cloud Scheduler lets you specify a time zone. Check the platform’s current documentation before relying on a particular daylight-saving or missed-run behavior.
#1 Best Overall
- Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
| Situation | Good starting choice |
|---|---|
| Windows PC or server | Windows Task Scheduler |
| Always-on Linux server, simple job | cron |
| Linux server where logs, status, or catch-up matter | systemd timer, if the system uses systemd |
| Mac | launchd |
| Computer is often off or asleep | A hosted scheduler, or a local scheduler with suitable missed-run behavior |
| Code already lives in GitHub | GitHub Actions, if the job can run on a hosted runner |
| Want hosted Python without administering a server | PythonAnywhere |
| Need a deployed container or service with run logs | Render cron jobs or a cloud runtime |
If your script needs local files, a USB device, a desktop application, or a home-network resource, schedule it on a computer that can access those things. A hosted runner is a separate machine and cannot see your computer’s files.
Prepare the script before scheduling it
Use a virtual environment and the same interpreter every time
A virtual environment keeps the project’s packages separate. Python’s venv documentation explains how to create one. Install your dependencies into that environment, then schedule its Python executable—not whichever python happens to appear first on PATH.
On Linux or macOS:
cd /absolute/path/to/project
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
.venv/bin/python script.py
On Windows PowerShell:
cd C:pathtoproject
py -m venv .venv
..venvScriptspython.exe -m pip install -r requirements.txt
..venvScriptspython.exe .script.py
Use a Python version your project supports. On Windows, the Python Windows documentation describes the py launcher and interpreter selection.
Make file paths independent of the starting directory
Schedulers may start a process from a different working directory than your terminal. Instead of opening data/input.csv relative to an assumed folder, build paths from the script’s location:
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent
input_file = BASE_DIR / "data" / "input.csv"
Set the scheduler’s working directory explicitly as well when the platform supports it.
Log failures and return a failure status
For a small job, Python’s logging module can write timestamped messages. Catch unexpected exceptions at the program boundary, record the traceback, and exit with a nonzero status so the scheduler can identify a failed run:
import logging
import sys
logging.basicConfig(
filename="/absolute/path/to/project/script.log",
level=logging.INFO,
format="%(asctime)s %(levelname)s %(message)s",
)
def main() -> None:
logging.info("Job started")
# Do the work here.
logging.info("Job completed")
if __name__ == "__main__":
try:
main()
except Exception:
logging.exception("Job failed")
sys.exit(1)
Choose a writable log location and consider how it will be rotated or cleaned up if the job runs indefinitely. Logs show what the program reported; they do not by themselves prove that the output is correct. For important tasks, add a notification or monitoring step too.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Keep secrets out of commands and source code
Do not put API keys in a public repository or in a task command that other users can read. Use a protected environment file, operating-system credential store, scheduler-managed environment variables, or a cloud secret manager as appropriate. Restrict access to local configuration files and exclude files containing credentials from version control.
Rank #2
- Includes Raspberry Pi 4 4GB Model B with 1.5GHz 64-bit quad-core CPU (4GB RAM)
- Includes Pre-Loaded 32GB EVO+ Micro SD Card (Class 10), USB MicroSD Card Reader
- CanaKit Premium High-Gloss Raspberry Pi 4 Case with Integrated Fan Mount, CanaKit Low Noise Bearing System Fan
- CanaKit 3.5A USB-C Raspberry Pi 4 Power Supply (US Plug) with Noise Filter, Set of Heat Sinks, Display Cable - 6 foot (Supports up to 4K60p)
- CanaKit USB-C PiSwitch (On/Off Power Switch for Raspberry Pi 4)
Windows: schedule it with Task Scheduler
Task Scheduler can launch programs at a daily trigger. The steps below use its full task settings, which expose the account, working directory, and run conditions that commonly cause trouble.
- Open Task Scheduler and choose Create Task.
- On General, enter a descriptive name and select the account that should run the job. Decide whether it must run only while that user is logged in or in the background; a background task may not have access to an interactive desktop.
- On Triggers, create a trigger set to Daily, choose the start date and time, and set it to recur every 1 day.
- On Actions, choose Start a program. In Program/script, enter the virtual environment’s full Python path, for example
C:pathtoproject.venvScriptspython.exe. In Add arguments, enter the full script path, such asC:pathtoprojectscript.py. In Start in, enter the project directory, such asC:pathtoproject. - On Conditions, check whether battery, idle, or network conditions could prevent a laptop from running the task. Configure these only if they match your needs.
- On Settings, allow an on-demand run. Decide what should happen if the job is still running when the next trigger arrives, and whether a missed task should be started later if that setting is available and appropriate.
- Save the task. Right-click it and choose Run to test it. Check History and Last Run Result, then inspect the script’s log.
Microsoft’s Task Scheduler overview and daily task example describe the scheduler and its triggers.
If quoting paths or setting up logging is awkward in the GUI, create a batch file such as run-job.bat:
Recommended Free Tools
@echo off
cd /d C:pathtoproject
C:pathtoproject.venvScriptspython.exe C:pathtoprojectscript.py >> C:pathtoprojectscript.log 2>&1
exit /b %ERRORLEVEL%
Schedule the batch file instead. A command-line alternative is schtasks /create with /sc daily; Microsoft documents its options in the schtasks reference. A wrapper is often simpler when paths contain spaces.
If a task works when you click Run but fails on schedule, verify which Windows account runs it. That account may not have access to a network share, credentials, or project files. Mapped drive letters may not exist in a background session; use a UNC path when appropriate.
Linux: use cron for a simple job
For a basic daily command on a machine that is normally running, edit your user crontab:
crontab -e
For 9:00 a.m. every day, add:
0 9 * * * /absolute/path/to/project/.venv/bin/python /absolute/path/to/project/script.py >> /absolute/path/to/project/script.log 2>&1
The five schedule fields are minute, hour, day of month, month, and day of week. For example:
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstall# Every weekday at 09:00
0 9 * * 1-5 /absolute/path/to/project/.venv/bin/python /absolute/path/to/project/script.py >> /absolute/path/to/project/script.log 2>&1
# Every day at 23:30
30 23 * * * /absolute/path/to/project/.venv/bin/python /absolute/path/to/project/script.py >> /absolute/path/to/project/script.log 2>&1
The redirection appends standard output and errors to the log. Cron often has a smaller PATH than an interactive shell and does not necessarily load shell startup files. Full executable and file paths avoid much of that ambiguity. A crontab reference is available at man7.org.
Rank #3
- Not including the Raspberry Pi 5 (8GB), the Crowpi advanced version comes with the Raspberry Pi 5
- ELECROW Black Case for the Raspberry Pi 5, CrowPi is equipped with a 9-inch HD touchscreen along with a camera; All the regular components used in DIY electronics are packed into the CrowPi development board, such as LCD, LED matrix, buzzer, light sensor, PIR sensor, ultrasonic sensor, IR sensor, etc
- Raspberry Pi Sensors: The Crowpi raspberry pi 5 programming kit is jam-packed with lots of buttons such as 19 different sensors in a tidy easy to use package; You don't have to wait and wire things
- Build Quality: Solid ABS shell and well made components in one place make it strong and convenient to travel
- Programming Lessons: This raspberry pi 5 learning kit ships with step by step instructions and provides 21 lessons to take you through identifying components reading code and running it in the terminal
Test the exact Python command in a terminal first. To test that cron itself is invoking jobs, temporarily add a harmless one-minute entry:
* * * * * date >> /tmp/cron-test.log 2>&1
Remove the test entry after confirming it runs. The machine must be on at the scheduled time; cron does not turn on a powered-off computer, and catch-up behavior is not universal.
Linux: use a systemd timer for more control
On a system that uses systemd, a timer paired with a one-shot service makes it easier to set a user, working directory, command, and inspectable logs. Create /etc/systemd/system/my-python-job.service:
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →[Unit]
Description=Daily Python job
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
User=myuser
WorkingDirectory=/opt/my-python-job
ExecStart=/opt/my-python-job/.venv/bin/python /opt/my-python-job/script.py
Replace myuser and the paths with the account and locations that should be used. Then create /etc/systemd/system/my-python-job.timer:
[Unit]
Description=Run my Python job daily
[Timer]
OnCalendar=*-*-* 09:00:00
Persistent=true
Unit=my-python-job.service
[Install]
WantedBy=timers.target
Persistent=true allows systemd to make up a missed calendar event when the timer becomes active again. It does not run the job while the computer is off or guarantee that the job succeeds.
Reload systemd, enable the timer, and inspect its next run:
sudo systemctl daemon-reload
sudo systemctl enable --now my-python-job.timer
systemctl list-timers my-python-job.timer
Run the service immediately and read its logs with:
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →sudo systemctl start my-python-job.service
journalctl -u my-python-job.service -n 100 --no-pager
Systemd does not automatically inherit the interactive shell’s environment. Provide needed variables explicitly, use an absolute executable path, and use Type=oneshot for a job that starts, completes, and exits. See the systemd timer documentation.
Rank #4
- Fully assembled for plug-and-play operation
- Includes Raspberry Pi 5 with 8GB RAM
- 256 GB PCIe Pi NVMe SSD (Pre-loaded with Pi 64-Bit OS)
- M.2 HAT+
- CanaKit Turbine Black Case for the Pi 5
Use cron when you want the shortest setup for a straightforward command. Prefer a systemd timer when you want native service status and journal logs, explicit execution settings, dependency ordering, or missed-calendar-event handling. Not every Linux environment uses systemd, so check the target system.
macOS: use launchd
macOS’s native job manager is launchd. For a job associated with your user session, create a property list at ~/Library/LaunchAgents/com.example.daily-python-job.plist. Replace /Users/alice and the project paths with your actual paths:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.daily-python-job</string>
<key>ProgramArguments</key>
<array>
<string>/Users/alice/project/.venv/bin/python</string>
<string>/Users/alice/project/script.py</string>
</array>
<key>WorkingDirectory</key>
<string>/Users/alice/project</string>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>9</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
<key>StandardOutPath</key>
<string>/Users/alice/project/script.out.log</string>
<key>StandardErrorPath</key>
<string>/Users/alice/project/script.err.log</string>
</dict>
</plist>
ProgramArguments is an array, with the interpreter and script as separate items; it is not a shell command string. Shell expansion and features such as globbing do not automatically work in property-list values. Apple’s launchd documentation describes job configuration; launchd.info provides additional behavior and environment detail.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsLoad the job into your GUI session, start it immediately for a test, and inspect it:
launchctl bootstrap gui/$(id -u)
~/Library/LaunchAgents/com.example.daily-python-job.plist
launchctl kickstart -k gui/$(id -u)/com.example.daily-python-job
launchctl print gui/$(id -u)/com.example.daily-python-job
To unload it:
launchctl bootout gui/$(id -u)
~/Library/LaunchAgents/com.example.daily-python-job.plist
A user LaunchAgent runs in the context of a user session; a system LaunchDaemon is a different deployment choice. GUI access, Keychain access, and desktop permissions may differ from an interactive Terminal session. Test on the Mac and macOS version where the job will run.
Test before waiting a day
- Run the exact command manually. Use the full interpreter and script paths. Confirm it succeeds using the intended virtual environment.
- Run it through the scheduler now. Use Task Scheduler’s Run,
systemctl start,launchctl kickstart, or a temporary one-minute cron entry as appropriate. - Check logs and status. Confirm a start and completion message, inspect errors, and check the scheduler’s run history or service status.
- Verify the result. Check the report, backup, database update, or other expected output—not just that the process started.
- Restore the intended schedule. Remove temporary test triggers so they do not continue to run.
For a one-time diagnostic, log the interpreter actually running the script:
import sys
print(sys.executable)
print(sys.version)
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Hosted scheduling: when your computer should not be responsible
Choose a hosted service if your computer is often off, the task is important enough to need centralized run history, or the code is already deployed. Hosted services run in their own environments: install dependencies there, configure secrets there, and check that the schedule’s time zone matches your intention.
Free tools Windows power users keep installed
One-click scans. No signup required.
GitHub Actions
GitHub Actions is a practical fit for a short job whose code is already in a GitHub repository and does not need access to your desktop or local files. A minimal workflow might look like this:
Best Value
- 【What you Get】You will get 1*Pi 5 8GB Single Board,1*RasTech Case,1*Active Cooler,1*Screwdriver,1*Installation instructions,12-month free warranty, lifetime service, 24-hour prompt and friendly response.
- 【More Connectors】There are two USB 3.0 ports(5Gbps simultaneously) and two USB 2.0 ports, which triple total bandwidth ,support any combination of up to two cameras or displays. Peak SD card performance is doubled through support for the SDR104 high-speed mode. It provides a smooth desktop experience for you. Offer Gigabit Ethernet and a PCIe interface, along with dual-band Wi-Fi and Bluetooth 5.0/BLE wireless capability. The RasTech Pi 5 Kit use the new 27W 5.1V 5A USB-C power connector.
- 【 Support Dual 4Kp60 Display 】Each of the two microHDMI sockets can control a 4K display at 60 Hertz, now support HDR, offering super HD video for media streaming projects. RPi 5 is the first RPi model that comes with a PCI Express port (PCIe 2.0 x1 with 500 MB/s) to attach SSDs (requires separate M.2 HAT).
- 【 Excellent Chips And Applications】Pi 5 is a full-size Pi computer using silicon built in-house at Pi. The RP1 “southbridge” provides the bulk of the I/O capabilities for Pi 5. Pi 5 is more friendly and convenient in the development of Internet of Things, Web development, machine identification, automatic control and other electronic equipment applications and network.
- 【 Faster CPU, Better GPU 】 Pi 5 features a Broadcom BCM2712 64-bit quad-core Arm Cortex-A76 processor running at 2.4GHz, it delivers a 2–3× increase in CPU performance relative to RaspberryPi 4. The 800MHz VideoCore VII GPU is compatible to OpenGL ES 3.1 and Vulkan 1.2, substantial uplift in graphics performance. Pi 5 Offers lightning-fast CPU speed, a PCI Express interface, a Real Time Clock (RTC) and a power button and runs significantly cooler than Pi 4.
name: Daily Python job
on:
schedule:
- cron: "0 14 * * *"
workflow_dispatch:
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Install dependencies
run: python -m pip install -r requirements.txt
- name: Run script
env:
API_KEY: ${{ secrets.API_KEY }}
run: python script.py
This example requests 14:00 UTC; check GitHub’s current schedule documentation for scheduling behavior and time-zone details before using it. Select a Python version supported by your project rather than copying the example’s version automatically. Configure API_KEY as a repository or environment secret. GitHub-hosted runners are temporary, so the workflow checks out code and installs dependencies for the run.
Actions usage and charges vary by repository visibility, plan, runner type, and minutes used. Check GitHub’s current Actions billing and runner pricing information rather than assuming every workflow is free.
PythonAnywhere
PythonAnywhere offers hosted Python execution and scheduled tasks without requiring you to administer a server. It may suit a small automation that fits the service’s runtime, networking, and package constraints. Plan features and limits change; check the current pricing and plan comparison, especially whether scheduled tasks are included in the plan you choose.
Render cron jobs
Render can run commands from a Git repository or Docker image and provides logs and run history. Its cron schedules use UTC, and Render documents that a given job has at most one active run at a time; if a run is still active, a later scheduled run is delayed. Pricing depends on active runtime and instance type; consult the Render cron job documentation for current limits and charges.
Google Cloud Scheduler plus an execution service
Cloud Scheduler does not run an arbitrary Python file by itself. It sends scheduled requests to a target such as an HTTP endpoint, Pub/Sub, or App Engine; your Python code would typically run in Cloud Run or another execution service. This is better suited to an application already packaged and deployed in the cloud than to a first local script.
Google describes delivery as at least once: retries and rare duplicate deliveries are possible. Make the operation idempotent—safe to repeat—or track job identifiers so a duplicate request does not repeat harmful side effects. See the Cloud Scheduler overview and its documentation for cron schedules and time zones. Total cloud cost depends on the scheduler and the compute, storage, network, and other services used.
Common failures and what to check
| Symptom | Likely cause | What to check |
|---|---|---|
python not found |
Scheduler PATH differs from your terminal | Use the full path to the intended Python executable. |
| Module not found | Wrong interpreter or virtual environment | Install dependencies with the same interpreter path used by the job. |
| File not found | Different working directory or relative paths | Set the working directory and build data paths from the script location. |
| Permission denied or network file missing | Different scheduler account or unavailable share | Check the run-as account, permissions, credentials, and use a UNC path on Windows where appropriate. |
| No visible output | Output not captured, or no logging configured | Redirect stdout and stderr or configure file/journal logging; check scheduler history too. |
| Job runs twice | Duplicate schedule, overlapping run, manual test, or cloud retry | Check for duplicate entries, configure single-instance behavior where available, and make external actions safe to repeat. |
| It does not run when the laptop is closed | Machine is asleep, powered off, or blocked by a condition | Review power and scheduler conditions, missed-run behavior, or move the job to a hosted service. |
| It runs at the wrong hour | UTC/local-time mismatch or daylight-saving change | Check the scheduler’s configured time zone and the platform’s schedule semantics. |
For “works in Terminal, fails automatically,” check in this order: full interpreter path, full script path, working directory, log output, installed dependencies, scheduler account and permissions, required environment variables, then the exact command in a manual run. A login shell may load configuration that a scheduler does not.
Prevent harmful overlap and duplicate effects
A daily trigger does not necessarily mean the previous run has finished before the next one begins. A long-running task can overlap with its next invocation, and some cloud schedulers retry a request if they do not receive a successful response. If duplicate emails, payments, imports, or database writes would be harmful:
- Make the operation idempotent where possible—for example, upsert a record rather than blindly inserting it.
- Use a lock or record a unique run identifier to prevent concurrent or repeated work.
- Set an appropriate timeout or single-instance policy if the scheduler supports it.
- Ensure the script exits when finished and returns a nonzero status when it fails.
Do not use a permanent loop such as while True: run_job(); time.sleep(86400) as the default for a daily task. It must remain alive, can stop on reboot or crash, and measures an interval rather than reliably targeting a clock time. A Python scheduling library is useful when an application is intentionally kept running and needs dynamic schedules; it does not replace an operating-system or hosted service that starts the process.
Quick Recap
Final setup checklist
- Does the task use the intended Python executable and virtual environment?
- Which account runs it, and can that account access every required file, network share, and credential?
- Is the working directory explicit, and are data paths robust?
- Where do standard output, errors, and application logs go?
- What time zone defines the scheduled time?
- What happens if the computer is asleep, off, or disconnected at that time?
- Can the job safely run twice, and what happens if it fails or takes longer than expected?
- Have you run it manually through the scheduler and verified the actual output?
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

