Script Error Trapping?

Scripts and programs to automate Astroart
Post Reply
rvyoung
Posts: 2
Joined: 28 Feb 2019, 18:50

Script Error Trapping?

Post by rvyoung » 01 Mar 2019, 17:46

I've been running a script to control my allsky camera without trouble for many months. I recently started running a Python script that FTP's the saved images to a web site. Now, some random time during the night, I'll get a script error that halts the script. I suspect that Windows is involved. I tried running AstroArt as Administrator but that didn't help. Here's the partial code and output:

Code: Select all

ImgName$ = "sky"+ImgNum$+".jpg"                ' sequenced filename
FilePath$ = AllpicsPath$+ImgName$              ' filename and path
print FilePath$
Image.SaveView(FilePath$)
pause(1)
FilePath$ = AllpicsPath$+"sky"+".jpg"          ' static filename for FTP
print FilePath$
Image.SaveView(FilePath$)

835,2019 02 27,03 07 41,133.09,30,2917,2147
sky0835.fit
C:\Allsky\AllskyPics\sky0835.jpg
C:\Allsky\AllskyPics\sky.jpg
836,2019 02 27,03 08 16,132.97,30,2945,2166
sky0836.fit
C:\Allsky\AllskyPics\sky0836.jpg
C:\Allsky\AllskyPics\sky.jpg
837,2019 02 27,03 08 52,132.86,30,2928,2179
sky0837.fit
C:\Allsky\AllskyPics\sky0837.jpg
C:\Allsky\AllskyPics\sky.jpg
Cannot save image. Check path and filename - Line 269
I'm wondering if there is a way to trap the error and take an alternative action? Likely, delay a second or two then retry. I'm running AstroArt 6 right now (have 7 but haven't loaded yet) and running in Windows 10.

Thanks, Rick

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

Re: Script Error Trapping?

Post by fabdev » 01 Mar 2019, 23:42

Hello, the problem is that you are overwriting the file "sky.jpg"
Sometimes it's possible that it's overwritten while the Python script is reading or transmitting it, maybe with exclusive access.

You could modify the Python script in several ways: it could copy the "sky.jpg" to another file and then transmit the other file.

Or maybe you could not use the "sky.jpg" and let the Python script to open the latest file (837, etc.)

rvyoung
Posts: 2
Joined: 28 Feb 2019, 18:50

Re: Script Error Trapping?

Post by rvyoung » 02 Mar 2019, 04:21

Thanks Fabio.

I'll look at modifying the Python script to be able to avoid using a static filename, so no overwriting occurs.

Rick

Post Reply