Skip to content

RuntimeError: asyncio.run() cannot be called from a running event loop #31

@zhuzhangZZ

Description

@zhuzhangZZ

Hello, I have use this package to try to control my SP-300, but when I run the test code, I have the errors as shown below,

Traceback (most recent call last):
  File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
    exec(code, globals, locals)
  File c:\modulationmicroscope\easy-biologic\tests\ocv.py:23
    prg.run()
  File c:\modulationmicroscope\easy-biologic\easy_biologic\base_programs.py:668 in run
    self._run( 'ocv', params, retrieve_data = retrieve_data )
  File c:\modulationmicroscope\easy-biologic\easy_biologic\program.py:514 in _run
    asyncio.run( self._retrieve_data( read_interval ) )

  File ~\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py:190 in run
    raise RuntimeError(

RuntimeError: asyncio.run() cannot be called from a running event loop
import logging
import easy_biologic as ebl
import easy_biologic.base_programs as ebp
logging.basicConfig( level = logging.DEBUG )
channels = [ 0 ]
by_channel = False
params = { 
	'time': 10 
}
save_path = 'D:\\EC-lab_test' 
if not by_channel:
	# file if saving individually
	save_path += '.csv'
bl = ebl.BiologicDevice( 'USB0')
# bl.connect()
prg = ebp.OCV( device=bl, params = params, channels= channels)
prg.run()
prg.save_data( save_path, by_channel = by_channel )

I have also run the code below, I got the informations.
print(bl.info)
<easy_biologic.lib.ec_lib.DeviceInfo object at 0x000001BD452BF2D0>
print(bl.kind)
DeviceCodes.KBIO_DEV_SP300

And I have checked the firmware version is 11.4, and the technique files (.dll) version is "techniques-6.04", So I was wondering that do you have any idea about how to fix this problem? I have struggled in this problem for more than one day, and I have no idea how to solve this probelm.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions