VimbaPython icon indicating copy to clipboard operation
VimbaPython copied to clipboard

API not started error VmbError.ApiNotStarted: -2

Open hugoleon77 opened this issue 3 years ago • 5 comments

Have had very many issues getting this library to work.

I am running a Windows machine with a Guppy Pro camera and Anaconda 4.11 with python 3.9 and jupyter

This is my latest error and am not sure how to resolve this

---------------------------------------------------------------------------VimbaCError Traceback (most recent call last)~\VimbaPython_Source\vimba\camera.py in _open(self) 906 try:--> 907 call_vimba_c('VmbCameraOpen', self.__info.cameraIdString, self.__access_mode, 908 byref(self.__handle)) ~\VimbaPython_Source\vimba\util\tracer.py in wrapper(*args, **kwargs) 133 else:--> 134 return func(*args, **kwargs) 135 ~\VimbaPython_Source\vimba\c_binding\vimba_c.py in call_vimba_c(func_name, *args) 752 global _lib_instance--> 753 getattr(_lib_instance, func_name)(*args) 754 ~\VimbaPython_Source\vimba\c_binding\vimba_c.py in _eval_vmberror(result, func, *args) 670 if result not in (VmbError.Success, None):--> 671 raise VimbaCError(result) 672 VimbaCError: VimbaCError(<VmbError.ApiNotStarted: -2>)

The above exception was the direct cause of the following exception: VimbaCameraError Traceback (most recent call last)C:\Users\JAMES~1.HAL\AppData\Local\Temp/ipykernel_10360/2024278461.py in 1 with Vimba. get_instance () as vimba: 2 cams = vimba . get_all_cameras ()----> 3 with cams [0] as cam: 4 frame = cam. get_frame () 5 frame. convert_pixel_format (PixelFormat.Mono8)~\VimbaPython_Source\vimba\util\tracer.py in wrapper(*args, **kwargs) 132 133 else:--> 134 return func(*args, **kwargs) 135 136 return wrapper ~\VimbaPython_Source\vimba\camera.py in enter(self) 360 def enter(self): 361 if not self.__context_cnt:--> 362 self._open() 363 364 self.__context_cnt += 1~\VimbaPython_Source\vimba\util\tracer.py in wrapper(*args, **kwargs) 132 133 else:--> 134 return func(*args, **kwargs) 135 136 return wrapper ~\VimbaPython_Source\vimba\util\context_decorator.py in wrapper(*args, **kwargs) 42 def wrapper(*args, **kwargs): 43 args[0]._context_entered = True---> 44 return func(*args, **kwargs) 45 46 return wrapper ~\VimbaPython_Source\vimba\camera.py in _open(self) 922 exc = VimbaCameraError(repr(err)) 923 --> 924 raise exc from e 925 926 self.__feats = discover_features(self.__handle)VimbaCameraError: <VmbError.ApiNotStarted: -2>

hugoleon77 avatar Jan 14 '22 21:01 hugoleon77

Hi,

From your description I see that you are using Python 3.6. VimbaPython requieres Python version 3.7 or higher

Best regards

Bernardo

BernardoLuck avatar Jan 17 '22 06:01 BernardoLuck

Hi,

From your description I see that you are using Python 3.6. VimbaPython requieres Python version 3.7 or higher

Best regards

Bernardo

Sorry that was a typo, we are actually on python 3.9

hugoleon77 avatar Jan 17 '22 20:01 hugoleon77

i have this error too. If you found the cause please share.

wonwon0 avatar Nov 30 '22 14:11 wonwon0

Hi, can you give an example of your code and/or check that the applicable commands are within the with Vimba.get_instance(): statement? Cheers, Teresa

Teresa-AlliedVision avatar Dec 01 '22 10:12 Teresa-AlliedVision

Hey @wonwon0, as mentioned by @Teresa-AlliedVision, please make sure to indent your code such that it is within the VmbSystem.get_instance() with-block. For whatever functionality (in this case, saving an image from the camera using VimbaX API), it should be written as given below:

from vmbpy import *
import cv2

with VmbSystem.get_instance() as vmb:
        cams = vmb.get_all_cameras()
        print("Cameras found: {}".format(len(cams)))

        with cams[0] as cam:
            frame = cam.get_frame()
            frame.convert_pixel_format(PixelFormat.Mono8)
            cv2.imwrite("frame.jpg", frame.as_opencv_image())

This example code can be found here.

4n1rudh-fh avatar May 31 '23 16:05 4n1rudh-fh