Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73427
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-06-19 06:32 -0700 |
| References | <1fe9debc-e3fc-4236-8669-31ba61683865@googlegroups.com> <mailman.11149.1403184213.18130.python-list@python.org> |
| Message-ID | <b8b7485e-735d-4226-af83-c73b3c8874d8@googlegroups.com> (permalink) |
| Subject | Re: DHCP query script not work. |
| From | 不坏阿峰 <onlydebian@gmail.com> |
在 2014年6月19日星期四UTC+7下午8时23分17秒,Peter Otten写道: > 不坏阿峰 wrote: > > > > > i got code recipes from here. and i want to run it on win 7. > > > http://code.activestate.com/recipes/577649-dhcp-query/ > > > > > > i have do some modify and use print to check how it is work, but i am > > > stucked now. > > > > > > hope someone can help me. thanks a lot. > > > > > > i meet this error: > > > > > > Traceback (most recent call last): > > > File "D:/Workspace/TestExcel/Test/test_DHCP.py", line 138, in <module> > > > offer = DHCPOffer(data, discoverPacket.transactionID) > > > File "D:/Workspace/TestExcel/Test/test_DHCP.py", line 82, in __init__ > > > self.unpack() > > > File "D:/Workspace/TestExcel/Test/test_DHCP.py", line 95, in unpack > > > dnsNB = int(data[268] / 4) > > > TypeError: unsupported operand type(s) for /: 'str' and 'int' > > > > The script is written for Python 3, and you seem to be using a Python 2 > > interpreter. While > > > > dnsNB = int(data[268]/4) > > > > would become > > > > dnsNB = ord(data[268])/4 > > > > in Python 2 that's probably not the only change that needs to be made. For > > someone not familiar with Python the easiest fix is to install Python 3.4 > > (you don't need to unistall Python 2) and to run the script as is. yes, i use Python 2.7. i am a beginner learn network program part. i can not modify it myself now, i have trid some days. hope some expert can help me correct this code in Python 2.7. many thanks in advanced.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
DHCP query script not work. 不坏阿峰 <onlydebian@gmail.com> - 2014-06-19 05:56 -0700
Re: DHCP query script not work. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-19 13:14 +0000
Re: DHCP query script not work. Peter Otten <__peter__@web.de> - 2014-06-19 15:23 +0200
Re: DHCP query script not work. soneedu@gmail.com - 2014-06-19 06:30 -0700
Re: DHCP query script not work. 不坏阿峰 <onlydebian@gmail.com> - 2014-06-19 06:32 -0700
Re: DHCP query script not work. Anssi Saari <as@sci.fi> - 2014-06-19 16:49 +0300
Re: DHCP query script not work. 不坏阿峰 <onlydebian@gmail.com> - 2014-06-19 06:56 -0700
Re: DHCP query script not work. 不坏阿峰 <onlydebian@gmail.com> - 2014-06-25 03:53 -0700
csiph-web