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

KeyError: -7 #18

Open
ulipoto opened this issue Jun 7, 2022 · 1 comment
Open

KeyError: -7 #18

ulipoto opened this issue Jun 7, 2022 · 1 comment

Comments

@ulipoto
Copy link

ulipoto commented Jun 7, 2022

I used python -m easy_biologic.find_devices in the terminal to find my potentiostat and got "VMP3: USB0" as a result. Using that for bl = ebl.BiologicDevice('VMP3: USB0') does not work.
The error received is:
EcError: ERR_COMM_CONNECTIONFAILED (-201): Could not establish communication with instrument.

Using only "USB0" returns KeyError: -7. And apparently, error -7 does not exist in the error list.

The Biologic USB driver is installed and the EC-lab software works fine with USB connection. I'm using the Biologic VMP3B-10 potentiostat.

Do I maybe use the wrong keyword with 'USB0'?

Code:

import easy_biologic as ebl
import easy_biologic.base_programs as blp

bl = ebl.BiologicDevice('USB0')

Full error:

File "C:\ProgramData\Anaconda3\lib\site-packages\easy_biologic\lib\ec_errors.py", line 108, in __init__
    ( code, message ) = EcError.errors[ value ]

KeyError: -7

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "D:\Python\untitled0.py", line 12, in <module>
    bl = ebl.BiologicDevice('USB0')

  File "C:\ProgramData\Anaconda3\lib\site-packages\easy_biologic\device.py", line 61, in __init__
    self.populate_info()

  File "C:\ProgramData\Anaconda3\lib\site-packages\easy_biologic\device.py", line 209, in populate_info
    self.connect()

  File "C:\ProgramData\Anaconda3\lib\site-packages\easy_biologic\device.py", line 178, in connect
    ecl.init_channels(

  File "C:\ProgramData\Anaconda3\lib\site-packages\easy_biologic\lib\ec_lib.py", line 864, in init_channels
    validate( err )

  File "C:\ProgramData\Anaconda3\lib\site-packages\easy_biologic\lib\ec_lib.py", line 1615, in validate
    raise EcError( err )

  File "C:\ProgramData\Anaconda3\lib\site-packages\easy_biologic\lib\ec_errors.py", line 111, in __init__
    raise ValueError( f'Unknown error value {value}.' )

ValueError: Unknown error value -7.`
```
@bicarlsen
Copy link
Owner

bicarlsen commented Jun 8, 2022

It seems this error is coming from easy_biologic.lib.ec_lib#init_channels where BL_LoadFirmware is called.

From the User's manual (EC-Lab Development Package: Users Guide, Version 6.00 - April 2017) The error is (ERR_GEN_NOCHANNEL[S]ELECTED, no channel selected).

Back tracking a bit, it appears that the issue is coming from easy_biologic.device.BiologicDevice#connect where self.info.NumberOfChannels is being used to determine the channels to initialize. This info is coming from the call to easy_biologic.lib.ec_lib#connect to get information about the channels, My best guess is that this is where something is going wrong.

Unfortunately, I don't have access to a VMP3B-10 and can not recreate the error on my devices, so you may have to do some playing around. I suggest printing out BiologicDevice.info before the call to ec_lib#init_channels to verify the channels are correct, and if not, try to traceback from there where the issue is being caused.

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