Hi all,
I would like to write a python script that takes input
of 2 ip address, one a start address and the other the
end address and prints a list of all ip address in
between in dotted-decimal format. I've attempted to
use the ipv4 module
(http://pynms.sourceforge.net/ipv4.html) ,but I am
unable to get past this error "AttributeError : 'str'
object has no attribute '_address".
Can any suggest a solution to this problem? Is there a
better way than using the ipv4 module?
Thanks,
Steve
[color=blue][color=green][color=darkred]
>>> from ipv4 import *
>>> ip = IPv4('10.0.0.1' )
>>> startadd = ip.nexthost()
>>> endadd = ('10.0.3.0')
>>> print startadd[/color][/color][/color]
10.0.0.2[color=blue][color=green][color=darkred]
>>> print endadd[/color][/color][/color]
10.0.3.0
[color=blue][color=green][color=darkred]
>>> while startadd != endadd:[/color][/color][/color]
.... startadd = ip.nexthost()
.... print startadd
....
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
File "C:\Python23\li b\ipv4.py", line 250, in __cmp__
return cmp(self._addre ss, other._address)
AttributeError: 'str' object has no attribute '_address'
_______________ _______________ ____
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
I would like to write a python script that takes input
of 2 ip address, one a start address and the other the
end address and prints a list of all ip address in
between in dotted-decimal format. I've attempted to
use the ipv4 module
(http://pynms.sourceforge.net/ipv4.html) ,but I am
unable to get past this error "AttributeError : 'str'
object has no attribute '_address".
Can any suggest a solution to this problem? Is there a
better way than using the ipv4 module?
Thanks,
Steve
[color=blue][color=green][color=darkred]
>>> from ipv4 import *
>>> ip = IPv4('10.0.0.1' )
>>> startadd = ip.nexthost()
>>> endadd = ('10.0.3.0')
>>> print startadd[/color][/color][/color]
10.0.0.2[color=blue][color=green][color=darkred]
>>> print endadd[/color][/color][/color]
10.0.3.0
[color=blue][color=green][color=darkred]
>>> while startadd != endadd:[/color][/color][/color]
.... startadd = ip.nexthost()
.... print startadd
....
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
File "C:\Python23\li b\ipv4.py", line 250, in __cmp__
return cmp(self._addre ss, other._address)
AttributeError: 'str' object has no attribute '_address'
_______________ _______________ ____
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
Comment