473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Re: Python script for tracert

En Tue, 30 Sep 2008 03:53:21 -0300, cindy jones <ma*******@gmail.com>
escribió:
Hello.. I'm trying to do a scripting for tracert in windows using
python...
I'm using popen(), but it displays only after the tracert is completed. i
want the results to be displayed for every route.

can anyone help me in this..
Use the subprocess module:

import subprocess
host = 'www.microsoft.com'
p = subprocess.Popen(["tracert", '-d', '-w', '100', host],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
while True:
line = p.stdout.readline()
if not line: break
print '-->',line,
p.wait()

--
Gabriel Genellina

Sep 30 '08 #1
1 4823
Hi,

I wrote small python only script for tcptraceroute some time ago.
This works without a subprocess:

http://www.thomas-guettler.de/script...ceroute.py.txt

Gabriel Genellina schrieb:
En Tue, 30 Sep 2008 03:53:21 -0300, cindy jones <ma*******@gmail.com>
escribió:
>Hello.. I'm trying to do a scripting for tracert in windows using
python...
I'm using popen(), but it displays only after the tracert is completed. i
want the results to be displayed for every route.

can anyone help me in this..

Use the subprocess module:

import subprocess
host = 'www.microsoft.com'
p = subprocess.Popen(["tracert", '-d', '-w', '100', host],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
while True:
line = p.stdout.readline()
if not line: break
print '-->',line,
p.wait()

--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
Oct 1 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Erik Johnson | last post by:
This is somewhat a NEWBIE question... My company maintains a small RDBS driven website. We currently generate HTML using PHP. I've hacked a bit in Python, and generally think it is a rather...
1
by: carramba | last post by:
Hi! Iam runing php on win32.. and Iam wondering if there is enyposibility to run tracert in php? if yes how should I do it? -- just keep swiming
1
by: Paul Bergson | last post by:
I need to code a tracert function from an asp page. I can write some asp but I'm saddled with notepad as my development suite. Any pointers on getting a tracert type function from within asp? ...
4
by: Just D. | last post by:
We all know that we can use TRACERT as a standalone application in Windows to get a whole way of IP nodes to go through. I need to implement almost same feature from my own application. What's the...
2
by: Kishan Hathiwala | last post by:
how do i make tracert command in .net without using 3rd party software?
2
by: Adrian | last post by:
Hi I need a VB dotnet ping and tracert GUI utility written in VB.net 2003 (not 2005). I was sure there would have been many working examples for ping but I cannot find any :( I was hoping to...
2
by: whitethomas12 | last post by:
Hi, I am kind of stuck on a project and I need some help with creating a VB.NET (Visual Studios 2008) application to do traceroute. I have looked all over the web and I cannot find anything...
0
by: whitethomas12 | last post by:
Hi, I currently have some basic code that allows me to run the tracert command through VB.NET and it also updates my database based on the results. I was wondering if someone can help me find...
2
by: whitethomas12 | last post by:
Hi, I currently have some basic code that allows me to run the tracert command through VB.NET and it also updates my database based on the results. I was wondering if someone can help me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.