Error trapping

Scripts and programs to automate Astroart
Post Reply
AlessandroMaitan
Posts: 17
Joined: 09 May 2019, 08:02

Error trapping

Post by AlessandroMaitan » 10 Feb 2020, 11:42

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

fabdev
Posts: 461
Joined: 03 Dec 2018, 21:43

Re: Error trapping

Post by fabdev » 12 Feb 2020, 16:31

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?

AlessandroMaitan
Posts: 17
Joined: 09 May 2019, 08:02

Re: Error trapping

Post by AlessandroMaitan » 12 Feb 2020, 19:53

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

Post Reply