VanDyke Software Forums

VanDyke Software Forums (
-   Scripting (
-   -   Python Scripting trying to clone session more than 9 times (

rlupi001 10-05-2019 12:38 AM

Python Scripting trying to clone session more than 9 times

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:

sessionsFileName = os.path.expanduser("~") + "\SessionList.txt"
        if not os.path.exists(sessionsFileName):
                        "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.")

        sessionFile =, "r", "utf-8")
        sessionsArray = []

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


        # 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:
                        #crt.Dialog.MessageBox("Connecting to Session: " + session)
                        t = session.split()
                        tt = t[0]
                        console = t[1]
                        if console.startswith("11.2."):
                                drone = Blah2ship.Clone()
                                drone = Blahship.Clone()
                        #drone.Screen.Synchronous = True
                        drone.Caption = tt
                        drone.Screen.Send("/home/fjordman/dist/inception/inception " + console + "\r")
                        drone.Screen.WaitForString("Select a reality: ", 10)
                except ScriptError:

bgagnon 10-06-2019 03:31 PM

Hi rlupi001,

What version of SecureCRT are you using?

Do you get an error when you try to connect to the 10th clone? (If so, what's the error?)

Do you also get this error if you make 10 clones of a tab manually?

If so, then it is likely a limitation imposed by the remote server.

rlupi001 10-09-2019 08:00 AM

Hi, Thanks for your reply!

I don't get any error message after the 5th session window is cloned but if I clone them manually i am able to connect just fine.. Hm I am using Version 8.3.0

bgagnon 10-09-2019 08:18 AM

Hi rlupi001,

To clarify:

I don't get any error message after the 5th session window is cloned...
Do you get any error message at any time?

Other than having synchronous commented out:

#drone.Screen.Synchronous = True
I don't see anything wrong with the script.

Are you sure the script completes?

Is Cancel available from the Script menu when it stops cloning the sessions?

If not, I would suggest you see if the results are any different in v8.5.4, the current, official release.

All times are GMT -6. The time now is 03:45 PM.