Skip to main content

Simple wakelock / keep-awake / stay-awake

Project description

GitHub tag (latest by date) PyPI PyPI - Downloads GitHub

⏰😴 wakepy

Simple wakelock written in Python. Keeps your computer from going to sleep.

  • Command line utility
  • Can be added into your long running scripts

Requirements

Wakepy is currently Windows only. Feel free to submit pull request(s) for other platforms.

Installing

pip install wakepy

Usage

Start from command line

python -m wakepy

Starts the program. While running, computer will not go to sleep. If battery running out, Windows might force laptop to sleep.

Set keepawake within a python script

from wakepy import set_keepawake, unset_keepawake

set_keepawake()
# do stuff that takes long time
unset_keepawake()

Details

Windows

The program simply calls the SetThreadExecutionState with the ES_SYSTEM_REQUIRED flag, when setting the keepawake, and removes flag when unsetting. The flag cannot prevent sleeping if

  • User closes the lid of their laptop
  • User presses power button
  • User selects Sleep from the Start menu.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wakepy-0.2.0.tar.gz (1.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page