I have a program that reads as follows:

#!/usr/bin/env python
import string
import os

def ssher():
#ssher takes a port input (if none entered, it defaults to 2024) and


def connector():
#connector checks to see if the autoconfigure file exists. If so, it uses that
#for information for where the public ssh machine exists, if not then it tries
#something sensible.
 global ipAddress, username

 if os.path.isfile("autoconf.txt"):
   autoconfigurer = open ( 'autoconf.txt' )
   ipAddress = autoconfigurer.readline()
   username = autoconfigurer.readline()
   autoconfigurer.close()
   string.strip(ipAddress)
   string.strip(username)
   print "IPAddress is %s and username is %s" % (ipAddress, username)
   print "using if"

 else:
   from getpass import getuser
   ipAddress = raw_input("We're 'pitching' this connection to another
machine. What's its IP address? Remember, this is probably a public
address.")
   username = getuser()
   string.strip(username)
   print "username is %s" % username



 print "Attempting to set up the tunnel from %s as %s" % (ipAddress, username)

 cmd2 = 'ssh -nNT -R 2024:localhost:2024 [EMAIL PROTECTED]' % (username, 
ipAddress)
 os.system(cmd2)

connector()


The autoconf.txt contains two lines, which first has an ip address and
second a username. The problem I'm having is that the string.strip()
doesn't appear to be stripping the newline off the username.

Any ideas? If you need more information, just ask!


James
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to