Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tracerouteparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

import cStringIO
try:
from StringIO import StringIO
except ImportError:
from io import StringIO

import re

class Probe(object):
Expand Down Expand Up @@ -109,7 +113,7 @@ def __str__(self):

def parse_data(self, data):
"""Parser entry point, given string of the whole traceroute output."""
self.parse_hdl(cStringIO.StringIO(data))
self.parse_hdl(StringIO(data))

def parse_hdl(self, hdl):
"""Parser entry point, given readable file handle."""
Expand Down Expand Up @@ -206,7 +210,7 @@ def demo():

# Built-up data structures as string. Should look effectively
# identical to the above input string.
print trp
print(trp)

if __name__ == '__main__':
demo()