[Tutor] Telnet login

2012-11-08 Thread T. Girowall
Hello All, 

I'm trying to telnet to a device with a particular IP address. I'm using the 
sample code below and get the following error: 
Erro 10061: "No connection could be made because the target machine actively 
refused it"

My firewall is turned off. 
I'm using Python 2.7
I'm using Windows XP

When I'm prompted for remote account, i enter the user name and then im 
prompted for the password which enter as well. 

I'm able to connect to the device using putty with following settings: 

ip: 192.168.xx.xx
port: 2332

Any help is appreciated, 
Tim
import getpass import sys import telnetlib HOST = "localhost" user = 
raw_input("Enter your remote account: ") password = getpass.getpass() tn = 
telnetlib.Telnet(HOST) tn.read_until("login: ") tn.write(user + "\n") if 
password: tn.read_until("Password: ") tn.write(password + "\n") 
tn.write("ls\n") tn.write("exit\n") print tn.read_all()
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] run perl script files and capture results

2013-01-09 Thread T. Girowall
New to programing and need some help. 
 
I have multiple perl script files that I would like to automate using python. 
Currently each one is ran individually and the output is manually examined. The 
perl script is ran form the command promp with arguments as follows: 
 
c:\scripts\perl>perl plscript.pl -cmnd1 -cmnd2
 
cmnd1 and cmnd2 are ran on files that reside within "perl" directory. The 
output is displayed in DOS window. 
 
My objective: 
1. Run the perl script using python
2. Capture the results from the DOS window and save it to python. Output 
consists of text names and corresponding numbers. 
 
I'm using python 2.7
 
Thank you!
Tim___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor