alexandrebarachant / muse-lsl

Python script to stream EEG data from the muse 2016 headset
BSD 3-Clause "New" or "Revised" License
629 stars 184 forks source link

Can't run list (OSError: [Errno 5] Input/output error) #87

Closed artyomb closed 5 years ago

artyomb commented 5 years ago

Hello, I have installed pip install muselsl with Python 3.6.3 But the muselsl list don't start:

user@note:~/Muse$ muselsl list
Searching for Muses, this may take up to 10 seconds...
Traceback (most recent call last):
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pexpect/spawnbase.py", line 166, in read_nonblocking
    s = os.read(self.child_fd, size)
OSError: [Errno 5] Input/output error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pexpect/expect.py", line 111, in expect_loop
    incoming = spawn.read_nonblocking(spawn.maxread, timeout)
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking
    return super(spawn, self).read_nonblocking(size)
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pexpect/spawnbase.py", line 171, in read_nonblocking
    raise EOF('End Of File (EOF). Exception style platform.')
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pygatt/backends/gatttool/gatttool.py", line 315, in scan
    scan.expect('foooooo', timeout=timeout)
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pexpect/spawnbase.py", line 341, in expect
    timeout, searchwindowsize, async_)
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pexpect/spawnbase.py", line 369, in expect_list
    return exp.expect_loop(timeout)
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pexpect/expect.py", line 117, in expect_loop
    return self.eof(e)
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pexpect/expect.py", line 63, in eof
    raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x7f8ab6405c50>
command: /usr/bin/hcitool
args: ['/usr/bin/hcitool', '-i', 'hci0', 'lescan']
buffer (last 100 chars): b''
before (last 100 chars): b'Set scan parameters failed: Operation not permitted\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: 1
flag_eof: True
pid: 10394
child_fd: 7
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
    0: re.compile(b'foooooo')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.pyenv/versions/3.6.3/bin/muselsl", line 11, in <module>
    sys.exit(main())
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/muselsl/__main__.py", line 52, in main
    cli = CLI(args.command)
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/muselsl/cli.py", line 9, in __init__
    getattr(self, command)()
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/muselsl/cli.py", line 32, in list
    list_muses(args.backend, args.interface)
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/muselsl/stream.py", line 33, in list_muses
    devices = adapter.scan(timeout=MUSE_SCAN_TIMEOUT)
  File "/home/user/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pygatt/backends/gatttool/gatttool.py", line 326, in scan
    raise BLEError(message)
pygatt.exceptions.BLEError: Unexpected error when scanning: Set scan parameters failed: Operation not permitted
jdpigeon commented 5 years ago

This is one of our common issues on Linux.

This is an issue with pygatt requiring root privileges to run a scan. Make sure you have libcap installed and run sudo setcap 'cap_net_raw,cap_net_admin+eip' which hcitool