Skip to content

Device doesn't check if it is open #4

@jonathanvanschenck

Description

@jonathanvanschenck

For native python-seabreeze, if the device has not be opened (dev.open(), usually called in seabreeze.spectrometers.Spectrometer.__init__ ), and some data is requested from the device, it will raise a seabreeze.cseabreeze._wrapper.SeaBreezeError error. This is only relevant if either you are trying to open the same device multiple times (in which case you also need to close the device too), or if you are directly using the seabreeze.cseabreeze.SeaBreezeDevice object which needs to be manually opened.
We should add something like a __assert_open() method to the seatease.cseatease.SeaTeaseDevice object which gets invoked inside every data requesting method call, so that it can raise a SeaBreezeError if the device hasn't been opened.
Also, the seatease.spectrometers.Spectrometer init function should also open the device, and it should be given .open() and .close() wrappers.

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions