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 the API in Python #38

Open
kopysov opened this issue Jul 11, 2023 · 3 comments
Open

Using the API in Python #38

kopysov opened this issue Jul 11, 2023 · 3 comments

Comments

@kopysov
Copy link

kopysov commented Jul 11, 2023

I'm trying to use the API in my Python program via pywin32 package that allows accessing COM objects and calling their methods.
Similarly to "the old way" described in the Power Point presentation:

Type t = Type.GetTypeFromProgID("Thermo Exactive.API_Clr2_32_V1", true);
object o = Activator.CreateInstance(t);

in Python I instantiate the COM object:
o = win32.client.Dispatch('Thermo Exactive.API_Clr2_32_V1')
and this works fine. However, when I try to get an InstrumentAccess object by calling Get method of the COM object, I get the following error:
Unable to load an assembly set being able to write RAW files

I've tested this in both 32-bit and 64-bit builds of Python. Moreover, a C# program implementing this "old way" of accessing the API throws the same error. The new way of accessing the API via loading the .NET assembly works fine.

Do I miss anything? Maybe, "the old way" does not work anymore?

@pisistrato
Copy link

pisistrato commented Mar 11, 2024

I am also interested in this.
I have been experimenting with clr.AddReference() and pythonnet, I managed to get the connection to the instrument (e.g. I can access orbitrap.DetectorClass), but I cannot get this
orbitrap.MsScanArrived += Orbitrap_MsScanArrived;
done in python.
It seesms the event is not recognized in python....

@jesse-canterbury
Copy link
Contributor

Hello! For the question from July of last year: this method of accessing the instrument is not supported on current instrument control software versions, sorry. This presumably would include all Exploris versions. Older Exactive and Q-Exactive versions may be supported; please leave a comment here indicating if that would be useful to know, and I will try to find out.

For the more recent question, I don't have experience with this. Can you build a C# app to access the instrument and handle events, and then connect your python code to the C# app (and the event handler)?

@pisistrato
Copy link

Hi,

Yes, what you have suggested works just fine. I was hoping to handle the events directly in python, but I guess they are not exposed.

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

3 participants