pywakeonlan
raw JSON → 3.1.0 verified Fri May 01 auth: no python
A small Python module for Wake-on-LAN (WoL). Sends magic packets to wake up remote machines. Current version is 3.1.0, with irregular releases.
pip install wakeonlan Common errors
error OSError: [Errno 13] Permission denied ↓
cause Creating raw socket requires root/admin privileges on some systems.
fix
Run the script with sudo (Linux/Mac) or as Administrator (Windows). Alternatively, use the library's default UDP broadcast method (no raw socket typically needed).
error AttributeError: module 'wakeonlan' has no attribute 'send_magic_packet' ↓
cause Old version of wakeonlan (< 1.0.0?) or incorrect import path.
fix
Upgrade to latest version: pip install --upgrade wakeonlan. Import using: from wakeonlan import send_magic_packet
error ValueError: invalid MAC address ↓
cause MAC address uses invalid characters or wrong format.
fix
Use format like 'AA:BB:CC:DD:EE:FF' (colon-separated hexadecimal pairs).
Warnings
breaking Python 3.6 support dropped in version 3.0.0. ↓
fix Upgrade to Python 3.7+.
breaking Python 2 support dropped in version 2.0.0. ↓
fix Use Python 3.6+ (now 3.7+ for latest).
gotcha Broadcast IP must allow UDP traffic on port 9 (or custom port). Firewalls may block it. ↓
fix Ensure UDP port 9 (or chosen port) is open and broadcast is allowed on your network.
gotcha MAC address format: accepted delimiters are ':' and '-', also 'xxxx.xxxx.xxxx' format (supported since v3.0.0). ↓
fix Use standard colon-separated format for maximum compatibility: 'AA:BB:CC:DD:EE:FF'.
Imports
- send_magic_packet wrong
from wakeonlan.wakeonlan import send_magic_packetcorrectfrom wakeonlan import send_magic_packet
Quickstart
from wakeonlan import send_magic_packet
# Send WoL packet to a device with the given MAC address
send_magic_packet('aa:bb:cc:dd:ee:ff')
# You can also specify the IP address and port
send_magic_packet('aa:bb:cc:dd:ee:ff', ip_address='192.168.1.255', port=9)
# Works with IPv6 (requires wakeonlan >= 3.1.0)
# send_magic_packet('aa:bb:cc:dd:ee:ff', ip_address='ff02::1')