initally i was using python3 and had a basic import error which i was able to solve by following this post LINK
But upon running it i get this error
Traceback (most recent call last):
File “optoMMPCheck.py”, line 6, in
value = grvEpic.GetDigitalPointState(1, 1)
File “C:\Users\Desktop\Development\git\optoMMP\optommp_init_.py”, line 59, in GetDigitalPointState
return int(self.UnpackReadResponse(data, ‘i’))
File “C:\Users\Desktop\Development\git\optoMMP\optommp_init_.py”, line 223, in UnpackReadResponse
raw = struct.unpack_from(‘>’+data_type, bytearray(data_block))
TypeError: unpack_from() argument 1 must be string or read-only buffer, not bytearray
i have tried installing python2.7 and have the same issue as above.
Would like to understand if it only works for linux? I am currently using windows
Doing a quick Google of ‘python byte array windows vs linux’ there does seem to be, well, differences between the two OS’s.
Let’s ping @torchard and see what he can suggest.
I know the optommp Python code was created to run on EPIC and RIO, but perhaps there is a tweak that can be made for Windows. I’m not sure; it’s out of my area of expertise.
I have not tested the package with Windows, so I’ll have to dig into this — with the changes from the other forum post I cannot imagine there’s a major difference between running it with 2.7 vs 3.X, so it is likely a Windows quirk.
I can confirm that the Python OptoMMP library works on EPIC, RIO, Linux and Windows.
Just need a little more time to try and understand what is causing the error and why we are not seeing it here.
Thank you @torchard for the insights. I was able to fix the issue by changing my python version to the one mentioned above and creating a new virtual environment