WOL MAC Address not working
<p>I'm trying to run a python script to send a magic packet to computers on my network. It works on the other computers, but when I try to run the script with my own MAC address I get an error. </p>

<p>This is my python script</p>

<pre><code>#!/usr/bin/env python
#Wake-On-LAN
#
# Copyright (C) 2002 by Micro Systems Marc Balmer
# Written by Marc Balmer, marc@msys.ch, http://www.msys.ch/
# This code is free software under the GPL

import struct, socket

def WakeOnLan(ethernet_address):

  # Construct a six-byte hardware address

  addr_byte = ethernet_address.split(':')
  hw_addr = struct.pack('BBBBBB', int(addr_byte[0], 16),
    int(addr_byte[1], 16),
    int(addr_byte[2], 16),
    int(addr_byte[3], 16),
    int(addr_byte[4], 16),
    int(addr_byte[5], 16))

  # Build the Wake-On-LAN "Magic Packet"...

  msg = b'\xff' * 6 + hw_addr * 16

  # ...and send it to the broadcast address using UDP

  s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
  s.sendto(msg, ('10.0.0.129', 9))
  s.sendto(msg, ('10.0.0.129', 7))
  s.close()

# Example use
WakeOnLan('30-5A-3A-03-82-AE')
</code></pre>

<p>With 10.0.0.129 being my local address and 30-5A-3A-03-82-AE being my physical address. </p>

<p>When I try to run the script I get this error</p>

<pre><code>Traceback (most recent call last):
  File "C:\xampp\htdocs\wol\wolme.py", line 35, in &lt;module&gt;
    WakeOnLan('30-5A-3A-03-82-AE')
  File "C:\xampp\htdocs\wol\wolme.py", line 15, in WakeOnLan
    hw_addr = struct.pack('BBBBBB', int(addr_byte[0], 16),
ValueError: invalid literal for int() with base 16: '30-5A-3A-03-82-AE'
</code></pre>

<p>Again, no other computer has this problem. Any help appreciated.</p>

<p>it won't work on any address separated by "-", because of this line:</p>

<pre><code>addr_byte = ethernet_address.split(':')
</code></pre>

<p>just change <code>WakeOnLan('30-5A-3A-03-82-AE')</code> with <code>WakeOnLan('30:5A:3A:03:82:AE')</code> and it will work, or instead change the line that says:</p>

<pre><code>addr_byte = ethernet_address.split(':')
</code></pre>

<p>with</p>

<pre><code>addr_byte = ethernet_address.split('-')
</code></pre>

<p>if you want to use "-" as separators.</p>

<p>Hope this helps!</p>

python wake-on-lan