¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

checking and reconnnecting python script after tws shutdown (or auto-restart)


 

Hi there,

I am a newbie struggling with the reconnection of my python script after tws auto restarts (or manual restart for that matter). I know similar questions have been asked before and I am trying to follow this advice?to use connectionClosed callback but cant really seem to get it working.?

my callback function:

def connectionClosed(self):
print('connection lost')
while self.isConnected() is False:
print('trying reconnection')
self.connect('127.0.0.1', 7497, 123)
time.sleep(30)

return

But it doesn't work. apparently the following error
AttributeError: 'NoneType' object has no attribute 'settimeout' occurs at line self.connect('127.0.0.1', 7497, 123) .


Quite desperate to get it working. Any help would be extremely appreciated!


?

Join [email protected] to automatically receive all group messages.