473,327 Members | 1,930 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,327 software developers and data experts.

how to read o/p of telenet (python) ?!

hi experts ,

i have code to telnet remote machine (unix)
i am using port 5400 to telnet but o/p is not in visible format when i run random commands or run

when i give as read_some() it displays some lines but in case of read_all() it gets hang !!

In actual i want to get some string from o/p and process pls help


[code]

import getpass
import sys
import telnetlib
import time
HOST = "hostname"
#user = raw_input("Enter your remote account: ")
#password = getpass.getpass()


user = "hostname"
password = "ABC"


tn = telnetlib.Telnet(HOST , 5400)
print "1"

print "2"
tn.write(user + "\n")
print "3"
if password:
tn.read_until("Password: ")
tn.write(password + "\n")

print "4"
tn.write("set alarm = off" + "\n")
tn.write("set event = off" + "\n")

print "5"
tn.write("Cd /Office-Parameters/" + "\n")

print "6"

tn.write("\n")
tn.write("\n")

tn.write("vlrsubquery msisdn=*******" + "\n")
tn.write("\n")

print tn.read_all()

tn.write("exit" + "\n")

tn.close()
Dec 10 '10 #1
0 1424

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Krishna | last post by:
Hi I am calling a python script using popen. as follows $handle = popen(" python input1.py ", 'r'); echo "'$handle'; " . gettype($handle) . "\n"; $read = fread($handle, 2096); echo "Read...
38
by: kbass | last post by:
In different articles that I have read, persons have constantly eluded to the productivity gains of Python. One person stated that Python's productivity gain was 5 to 10 times over Java in some in...
27
by: Reiner Block | last post by:
Hi, does anybody knows a really good Python reference? It is not the matter if it is online or a book, if it is in english or german. Because the official one from www.python.org is really bad....
7
by: Bo Peng | last post by:
Dear Python group: I am planning on an application that involves several complicated C++ classes. Basically, there will be one or two big data objects and some "action" objects that can act on...
47
by: Michael Scarlett | last post by:
There is an amazing article by paul graham about python, and an even better discussion about it on slashdot. The reason I point this out, is the more I read both articles, the more I realised how...
114
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? maurice
31
by: surfunbear | last post by:
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is...
6
by: Kalle Anke | last post by:
Those who have read my posts today have probably understood that I'm not a "true" Python programmer ... but I want to learn more (I think that Python is rather fun). I've read "Learning Python"...
5
by: Falc | last post by:
Hi there... I have been looking at learning Python, so far it looks like an absolutely grat language. I am having trouble finding some free resources to learn Python from. I am on windows and...
6
by: py | last post by:
I want to serialize an object in jython and then be able to read it in using python, and vice versa. Any suggestions on how to do this? pickle doesnt work, nor does using ObjectOutputStream...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.