Coder Social home page Coder Social logo

Comments (5)

ChristopherRogers1991 avatar ChristopherRogers1991 commented on August 30, 2024

Both of those functions run the relevant irsend commands, and save the result in a variable called output. Can you try printing the value of output and pasting the result here?

from python-irsend.

jschiefner avatar jschiefner commented on August 30, 2024

Hey @ChristopherRogers1991 glad you answered :) the output variable for list_remotes contains the following string:

devinput
fernbedienung
devinput


playing around with it a little more gives the following results:

>>> print output
devinput
fernbedienung
devinput


>>> remotes = [l.split()[-1] for l in output.splitlines()]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: list index out of range
>>> output.splitlines()
['devinput', 'fernbedienung', 'devinput', '']
>>> 'devinput'.split()
['devinput']
>>> 'devinput'.split()[-1]
'devinput'

for list_codes the output is the following: (i am printing output here too)

>>> irsend.list_codes("fernbedienung")
00000000e0e006f9 KEY_UP
00000000e0e046b9 KEY_RIGHT
00000000e0e0a659 KEY_LEFT
00000000e0e0e01f KEY_VOLUMEUP
00000000e0e0d02f KEY_VOLUMEDOWN
00000000e0e08679 KEY_DOWN
00000000e0e058a7 KEY_MENU
00000000e0e016e9 KEY_ENTER
00000000e0e0f00f KEY_MUTE
00000000e0e0807f KEY_CHANNEL
00000000e0e0d22d KEY_OPTION
00000000e0e0f807 KEY_INFO
00000000e0e0e21d KEY_PLAY
00000000e0e052ad KEY_PAUSE
00000000e0e040bf KEY_POWER


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python2.7/site-packages/py_irsend/irsend.py", line 80, in list_codes
    codes = [l.split()[-1] for l in output.splitlines()]
IndexError: list index out of range
>>>

from python-irsend.

ChristopherRogers1991 avatar ChristopherRogers1991 commented on August 30, 2024

It looks like both of those have an empty line at the end, which is causing it to choke:

>>> ''.split()[-1]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: list index out of range

The solution is probably to eliminate the blank lines. It shouldn't be too hard to filter them out. I'll push up a change to a branch.

Out of curiosity, do you have any guesses about what's causing the blank lines? I've used this on a couple different versions of Raspbian, and a couple different versions of Ubuntu, and have not seen this happen.

from python-irsend.

ChristopherRogers1991 avatar ChristopherRogers1991 commented on August 30, 2024

Alright, I think https://github.com/ChristopherRogers1991/python-irsend/tree/bugfix/index_out_of_range should fix it. @jschiefner, can you test that branch, and let me know if it resolves the issue for you?

from python-irsend.

ChristopherRogers1991 avatar ChristopherRogers1991 commented on August 30, 2024

#2 has been merged, which resolves this issue. It has been released in 1.0.1, and can be installed with pip.

from python-irsend.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.