Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

Reply
 
Thread Tools Display Modes
  #1  
Old 09-02-2020, 11:30 PM
kva kva is offline
Registered User
 
Join Date: Jul 2020
Posts: 10
Exception for "The specified network name is no longer available"

The common part of my script is
Code:
def connect():
    global nr
    for i in range(60):
        if not tab.Session.Connected:
            try:
                tab.Session.Connect()
                nr = tab.Screen.WaitForStrings('#', 20)
                break
            except ScriptError:
                pass
        else:
            nr = True
            break
    else:
        return False
    return nr

def main():
    global nr
    sending, waitingforstring, etc

tab = crt.GetScriptTab()
tab.Screen.Synchronous = True
tab.Screen.IgnoreEscape = True

if connect():
    main()
Sometimes when script tries to connect to unavailable device, the pop-up window tells me: "The specified network name is no longer available". ScriptError does not handle this error? Which exception should?
Reply With Quote
  #2  
Old 09-03-2020, 08:59 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,034
Quote:
Originally Posted by kva View Post
Sometimes when script tries to connect to unavailable device, the pop-up window tells me: "The specified network name is no longer available". ScriptError does not handle this error? Which exception should?
In your case, I'm not sure if an exception is even being thrown.

Calling Session.Connect() without args is equivalent to pressing the Reconnect button on the toolbar.

If all you are doing is passing on the exception, why even bother with the exception type? If you just use except: without specifying an exception type, I'm thinking that you would most likely still see the pop-up.

The only way to suppress Connect() related pop-up messages via scripting is to supply parameters to the Connect call sufficient to suppress pop-up messages which, in your case I'm guessing isn't how you want to use Connect() (because you likely want to leverage the fact that the tab has already been connected and you just want to have it reconnected since it's been disconnected for some time).

I've added a feature request for a way via scripting to reconnect a tab without any popups so that you can handle connection errors via a script.

I don't have any ETA on when/if this might ever become available, but if it does we can post here and inform you and the forum community.

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support

Last edited by jdev; 09-08-2020 at 07:33 AM.
Reply With Quote
  #3  
Old 09-06-2020, 10:18 PM
kva kva is offline
Registered User
 
Join Date: Jul 2020
Posts: 10
Thank you for hints, Jake.
Catching "Exception" does what I want. I'm satisfied with it. If it will pass for the solution, then the thread may be closed.
Reply With Quote
  #4  
Old 09-08-2020, 07:53 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,034
Quote:
Originally Posted by kva View Post
Thank you for hints, Jake.
Catching "Exception" does what I want.
Ha! I'm glad to know that I was so wrong about the majority of my post, but my backup idea worked unexpectedly.

Thanks for trying it out and letting me know.

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #5  
Old 09-09-2020, 08:21 PM
kva kva is offline
Registered User
 
Join Date: Jul 2020
Posts: 10
Time has passed and base exception handles it no more. I think there were specific network state (ARP state perhaps) on my PC.
Feature request for handling system exceptions or passing specific arguments for connect() is still on
Reply With Quote
  #6  
Old 09-10-2020, 08:03 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,034
Quote:
Originally Posted by kva View Post
Time has passed and base exception handles it no more. I think there were specific network state (ARP state perhaps) on my PC. Feature request for handling system exceptions or passing specific arguments for connect() is still on :)
Urgh. Sorry that the workaround didn't provide positive results after all. The feature request is still on, and while we don't have any ETA, we'll still plan to post here if there's any movement on it becoming available in a future version of SecureCRT.

Out of curiosity... have you considered simply enabling the Auto reconnect option in the Terminal category of Session Options rather than attempting to reconnect disconnected tabs (silently) using a script?

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #7  
Old 09-21-2020, 02:15 AM
kva kva is offline
Registered User
 
Join Date: Jul 2020
Posts: 10
Quote:
Originally Posted by jdev View Post
Out of curiosity... have you considered simply enabling the Auto reconnect option in the Terminal category of Session Options rather than attempting to reconnect disconnected tabs (silently) using a script?
--Jake
Sorry for late answer. Auto-reconnect doesn't match my usage scenarios. Anyway, "the problem" has a lowest priority and actually does not spoil my network life
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 09:58 PM.