Page 1 of 1

Error trapping

Posted: 10 Feb 2020, 11:42
by AlessandroMaitan
I've been running a script where if necessary I need to connect a focuser after disconnecting the scope.
All functioned correctly until the day before yesterday when due to an unknown reason the system returned the message "Could not connect the device" and stopped the script.
I found out the problem after some time because I checked the system before going to sleep. I normally use the script to command the scope through the night.
So my question is if in such a case it is possible to trap the error and foresee an instruction to put the system in safety.

Thanks and regards.

Alessandro

Re: Error trapping

Posted: 12 Feb 2020, 16:31
by fabdev
Usually the .Connect commands stop the script if a connection error is found. For your research would you prefer a different Connect command which returns True or False?

Re: Error trapping

Posted: 12 Feb 2020, 19:53
by AlessandroMaitan
Hi Fabio,
thank you for the answer. Well, it could be useful having the possibility to check if the .connect was successful or not so I can foresee a routine either to continue (i.e. even if the image is not well focused I can do photometry) or to place the scope in a safe position and close the roof. In any case the scope is operating unattended and if the script is stopped nothing move until my next check.
Thanks.

Alessandro