Page 1 of 1

No capture with a script in python

Posted: Sun Oct 22, 2023 4:02 pm
by michastro
Hello,
I have a script wich seems to work fine except thatr nothing is captured!!
Here is my script:

Code: Select all

from time import sleep
from System import TimeSpan
from SharpCap.UI import CaptureLimitType
delay =30
SharpCap.SelectedCamera = SharpCap.Cameras[0]
SharpCap.SelectedCamera.Controls.FindByName("Timestamp Frames").Value = "On"
SharpCap.SelectedCamera.Controls.FindByName("Capture Area").Value = "480x480"
SharpCap.SelectedCamera.Controls.FindByName("Exposure").Value=1
SharpCap.SelectedCamera.Controls.FindByName("High Speed Mode").Value="On"
SharpCap.SelectedCamera.Controls.FindByName("Binning").Value="2"
SharpCap.SelectedCamera.Controls.FindByName("Colour Space").Value="MONO16"
SharpCap.SelectedCamera.CaptureConfig.CaptureLimitType = CaptureLimitType.TimeLimited
SharpCap.SelectedCamera.CaptureConfig.CaptureLimitTime = TimeSpan.FromSeconds(delay)
SharpCap.SelectedCamera.PrepareToCapture()
SharpCap.SelectedCamera.RunCapture()
sleep(delay+5)
SharpCap.SelectedCamera = None
SharpCap.ExitApplication()
The number of frames captured in the bottom of page stays at 0!
I have forgotten something, but I don't know what.
Thanks for your help.
Michel

Re: No capture with a script in python

Posted: Mon Oct 23, 2023 1:45 pm
by admin
Hi Michel,

what version of SharpCap are you using and what camera? I tried this out in the latest 4.1 (using the 'high speed' test camera and an Altair camera) and both worked.

I simplified the script down to

Code: Select all

from time import sleep
from System import TimeSpan
from SharpCap.UI import CaptureLimitType
delay =30
SharpCap.SelectedCamera.CaptureConfig.CaptureLimitType = CaptureLimitType.TimeLimited
SharpCap.SelectedCamera.CaptureConfig.CaptureLimitTime = TimeSpan.FromSeconds(delay)
SharpCap.SelectedCamera.PrepareToCapture()
SharpCap.SelectedCamera.RunCapture()
sleep(delay+5)
SharpCap.SelectedCamera = None
which just works on the current camera with the currently selected settings.

One thing that might be possible is that the change of certain controls may need a delay after it happens to allow the camera to restart in the new mode - resolution, bit depth, binning are among the controls that could require this.

cheers,

Robin

Re: No capture with a script in python

Posted: Tue Oct 24, 2023 1:14 pm
by michastro
Thanks as usally for your help Robin,
In fact after a lot of different tests, the cameras was working in Ascom mode, but not in native SharpCap mode, I had to shut down the camera AND the PC (to shut down USB) to unlock the camear, and now the script is working!
Michel

Re: No capture with a script in python

Posted: Tue Oct 24, 2023 1:40 pm
by admin
Hi,

good to hear you got it working - what camera was it by the way? Just wondering if I have a bug in the direct support somewhere?

cheers,

Robin

Re: No capture with a script in python

Posted: Tue Oct 24, 2023 1:51 pm
by michastro
A ZWO 6200

Re: No capture with a script in python

Posted: Wed Oct 25, 2023 10:39 am
by admin
Hi,

normally the ZWO cameras are pretty well behaved - I wonder if it got confused by being accessed both directly and via ASCOM in one session?

Let's hope it stays well behaved in future!

cheers,

Robin