I will try this one too...thanks for your response.
Iain King wrote:
> [EMAIL PROTECTED] wrote:
> > mac_string = '001485e55503'  (This is the mac address of a computer.)
> >
> > I am using wake on LAN python script to start computer remote.It uses
> > format like this ....
> >
> > s.sendto('\xff'*6 + '\x00\x014\x85\xe5\x55\x03'*16, ('192.168.1.255',
> > 80))
> >
> > where '\x00\x14\x85\xe5\x55\x03' is the MAC address to be used.
> >
> >
> > What I do is break the string into 6 parts like this,
> >
> > str01=mac_string[0:2]
> > str02=mac_string[2:4]
> > str03=mac_string[4:6]
> > str04=mac_string[6:8]
> > str05=mac_string[8:10]
> > str06=mac_string[10:12]
> >
> > and if I use it like this
> >
> > s.sendto('\xff'*6 + '\xstr01\xstr02\xstr03\xstr04\xstr05\xstr06'*16,
> > ('192.168.1.255', 80))
> > I get an error
> >
> >
> > I also tried like this
> > s.sendto('\xff'*6 + 'mac_string'*16, ('192.168.1.255', 80))
> >
> > Thiis also didnt work.
> >
> >
> > Since the MAC adddress are hexadecimal, how should I go about it here.
> >
> > Please help, every help is appreciated. Thanks
>
> See http://docs.python.org/lib/typesseq-strings.html
>
> You probably want:
>
> s.sendto('\xff'*6 + ('\x%s\x%s\x%s\x%s\x%s\x%s' % (str01, str02, str03,
>  sttr04, str05, str06))*16, ('192.168.1.255', 80))
> 
> Iain

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to