View Single Post
  #1  
Old 10-05-2019, 01:38 AM
rlupi001 rlupi001 is offline
Registered User
 
Join Date: Oct 2019
Posts: 1
Python Scripting trying to clone session more than 9 times

Hello,

First of all i'd like to thank anyone that can help me with this.

I am running a script that I want to take a list of hosts and run a session into a step server and clone this session multiple times in order to login to each host in my list. However, i find that after 9 cloned tabs my connections seem to not execute properly anymore and just skip each host to the end of the file..

Is there a limit that is going on here that does not let me open and send cmds to more then 9 cloned tabs/windows? Here is my code:
Code:
sessionsFileName = os.path.expanduser("~") + "\SessionList.txt"
	if not os.path.exists(sessionsFileName):
		crt.Dialog.MessageBox(
			"Session list file not found:\n\n" +
			sessionsFileName + "\n\n" +
			"Create a session list file as described in the description of " +
			"this script code and then run the script again.")
		return

	sessionFile = codecs.open(sessionsFileName, "r", "utf-8")
	sessionsArray = []

	for line in sessionFile:
		session = line.strip()
		if session:	# Don't add empty lines/sessions
			sessionsArray.append(session)

	sessionFile.close()

	# Connect to each session and issue a few commands, then disconnect.
	Blahship = crt.Session.ConnectInTab("/S Blah-Blah\Blah-Blah")
	Blah2ship = crt.Session.ConnectInTab("/S Blah-CONSOLE\Blah-Blah")
	for session in sessionsArray:
		try:
                        #crt.Dialog.MessageBox("Connecting to Session: " + session)
			t = session.split()
			tt = t[0]
			console = t[1]
			if console.startswith("11.2."):
				drone = Blah2ship.Clone()
			else:
				drone = Blahship.Clone()
			#drone.Screen.Synchronous = True
			#drone.Screen.WaitForCursor(10)
			drone.Caption = tt
			drone.Screen.Send("/home/fjordman/dist/inception/inception " + console + "\r")
			drone.Screen.WaitForString("Select a reality: ", 10)
			drone.Screen.Send("f\r")
		except ScriptError:
			crt.GetLastErrorMessage()
Reply With Quote