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

IndexError: list index out of range #23

Open
nprabhav opened this issue Feb 18, 2019 · 7 comments
Open

IndexError: list index out of range #23

nprabhav opened this issue Feb 18, 2019 · 7 comments

Comments

@nprabhav
Copy link

Getting error while calling client.get_news()

python3.6/site-packages/gnewsclient/gnewsclient.py", line 136, in scrape_feed
article['link'] = entry.link['href'].split('&url=')[1]
IndexError: list index out of range

@Nowado
Copy link
Contributor

Nowado commented Feb 19, 2019

Check current version. I run into the same issue and fixed it.

@nprabhav
Copy link
Author

I guess the issue was in the following function of pymessegener in your fb bot.
bot.send_generic_message(sender_id, elements)
Error type': 'OAuthException'

bot.send_text_message(sender_id,elements[0]['title']) works fine.

@rsyqvthv
Copy link

rsyqvthv commented Feb 21, 2019

@nprabhav i got the same error when I call gnews --query usa:

lib/python3.5/site-packages/gnewsclient/gnewsclient.py", line 136, in scrape_feed
    article['link'] = entry.link['href'].split('&url=')[1]

IndexError: list index out of range

how can I fix this?

trying your last hint, but can't find bot.send_generic_message(sender_id, elements) in code, could you give me more details of how to get it work? thanks.

@Nowado
Copy link
Contributor

Nowado commented Feb 21, 2019

Are you working with current version from github?

49c3a74

If no, does this change fix it for you?

I didn't run into OAuthException at all however.

@rsyqvthv
Copy link

thanks for your quick reply @Nowado

before I describe my tryings, here is my env: ubuntu server 16, python3.5, pipenv 2018.11.26

here is what I tried:

1, install with pipenv install gnewsclient, I can gnews --config with good output, but when I gnews --query or anything else to actually read the news from google, the line 136 error shows up, which I mentioned last post here.

2, start a new pipenv folder, and install with pipenv install -e git+https://github.com/nikhilkumarsingh/gnewsclient#egg=gnewsclient, installation finished without any problem, but when I try gnews --config , it shows following error:

 File "/home/username/.local/share/virtualenvs/gn-x0_4Iz6_/src/gnewsclient/gnewsclient/gnewsclient.py", line 81
    print(f"{self.edition} edition not found.\n"
                                               ^
SyntaxError: invalid syntax

and of course, if I try gnews --query usa, same invalid syntax error shows and python stops.

3, start a new pipenv folder, and install with pipenv install -e git+https://github.com/nikhilkumarsingh/gnewsclient/tree/49c3a7443fd4f847ab06e1405e106ae310ae6538#egg=gnewsclient, which is I think will install the 49c3a74 commit, but I am unfamiliar with git, please correct me if I am wrong. :) , the installation is interrupted whenPinning VCS Packages and shows me error output as following:

pipenv.patched.notpip._internal.exceptions.InstallationError: Command "git clone -q https://github.com/nikhilkumarsingh/gnewsclient/tree/49c3a7443fd4f847ab06e1405e106ae310ae6538 /tmp/requirementslibg4s6vgnk/gnewsclient" failed with error code 128 in None

so, what should I do to install the 49c3a74 commit to my pipenv folder? thanks.

@nprabhav
Copy link
Author

@2anyone There is problem in gnewsclient in retrieving the link of the article, what I did to make it run was I used a try except block, go to gnewsclient.py and insert the line 136 in try and in except you can set it to None.

@nprabhav
Copy link
Author

nprabhav commented Feb 21, 2019

@Nowado I was talking about your Facebook Messenger Bot.
bot.send_generic_message(sender_id, elements)
is not working.
I will open the issue in that repository.

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

3 participants