Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using vmbpy.VmbSystem.get_instance() outside of a context manager #23

Open
Th-Havy opened this issue Feb 14, 2024 · 1 comment
Open

Comments

@Th-Havy
Copy link

Th-Havy commented Feb 14, 2024

Hello,

Because of the current software architecture of my program I cannot use the vmb/camera using a context manager. I would like to just initialize the communication and the camera at startup, and keep a reference to it during the whole lifetime of the program.

I tried calling manually __enter__() and __exit__(), which works to some extend. The issue is that I get a huge amount of trace logs in the console, which I cannot remove despite my attempts using vmb.enable_log().

I know that calling manually enter and exit is not an optimal solution but it seems to be the only workaround to use a camera outside of a with statement.

My question is thus the following: is there a proper way to use vimba x outside of a context manager. If not, is there at least a way to disable all the trace logs that are written to the console when manually calling enter/exit.

Thanks

@GuillaumeBeaudin
Copy link

Hello @Th-Havy !

I had a similar issue with the context manager. On my side, I tried to start it before starting a GUI, but when I was trying to access the cam object from another thread it would fail saying that I was outside the context manager. While I would also prefer to be able to access the camera outside the context manager, I implemented a solutions that work quite well. Basically, I used the context manager to connect to the camera in another thread (it could probably be in another process also) and I implemented a queue system to send command and receive data. You can see an exemple of what I'm talking about here:

#22 (comment)

I hope it can be useful for you!

Cheers,

Guillaume

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants