The attached script fails regularly. Put the camera in rec mode, and zoom-in about half-way. If the 'set_zoom(znext)' is successful, then the script executes, no problem. If however, get_zoom() doesn't return the set zoom level, things get interesting...
Some of the time, you will see the message "i= 2", the lens will move in/out, and the script succeeds. More often it will display the message, then crash.
EDIT: oops, wrong script.... corrected.
Camera in P mode, AF Frame Center, Servo AF off, Continuous AF On
Great, thanks. I was able to reproduce the crash on both elph180 and elph130, with continuous AF On. It sometimes took me a lot of shots to reproduce, showing i=2 in the console several times before crashing.
I wasn't able to reproduce it with continuous AF off.
I tried putting a sleep(10) after each set_zoom, and was not able to reproduce the crash after this.
Because of the variability in how many shots it took to reproduce, I'm not 100% sure either of the above actually prevents the problem.
Adding set_zoom_speed(1) at the top the script, it crashes repeatably with the same assert on the first shot. Sleeps after the set_zoom make no difference. It does not appear to crash with continuous AF off.
Interestingly, using set_zoom_speed(1) and set_zoom() seems to work fine in continuous AF without the shoot. Based on this, I tried putting sleep(500) after the shoot, and that seems seems to avoid the crash. In this case, I never saw the i=2 messages. sleep(100) was not enough to avoid the crash.
The assert appears likely to be triggered by TryTakeSemaphore failing (in elph330 100f ff225028 / elph130 ff1e9a18), although there's another case that could potentially trigger it as well. It seems likely that set_zoom and continuous AF could tie up the semaphore unexpectedly.
tl:dr:
If you want to try to use set_zoom_speed(1), try putting a decently long (500+ms) sleep between the shoot and the first set_zoom
edit:
I was able to reproduce the crash on elph130 running 1.4 r5528. It happens pretty quickly with or without sleeps after the set_zoom() calls. I still haven't been able to reproduce on 1.5 with sleep after set_zoom, despite trying a bunch more times. sleep(500) after shoot appears to avoid the crash for both 1.4 and 1.5