mobiusklein / ms_deisotope

A library for deisotoping and charge state deconvolution of complex mass spectra

Home Page:https://mobiusklein.github.io/ms_deisotope

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error message not being thrown or acknowledged in code

zmunro opened this issue · comments

If this import doesn't succeed, it is currently failing silently. The error message should be logged or raised.

Thank you for the suggestion. It brought my attention back to some rather old code and a pattern that could use some cleaning up.

This is by design, as the message is captured and raised later only if the user explicitly asks for this type via infer_reader or related module function. In particular, this is platform-dependent code (Windows only, must install optional dependency and have a 3rd party proprietary COM C++ DLL installed and registered) but it must be imported to register the reader type and how to check if it is the right format for any given file.

I do see that if you try to instantiate an instance of thermo_raw.ThermoRawLoader when the comtypes wrapper fails to import, it will fail with a NameError because _ThermoRawFileAPI won't be defined. That should be replaced with another placeholder when it's not available that re-raises that error as well.

Did you encounter this issue by directly instantiating thermo_raw.ThermoRawLoader?

The error is now at least acknowledged more carefully in the public interface code.

Thank you again for reporting this.