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

Error Raised: TypeError: list indices must be integers, not unicode #3

Open
wenlibin02 opened this issue Oct 20, 2019 · 5 comments
Open

Comments

@wenlibin02
Copy link
Contributor

wenlibin02 commented Oct 20, 2019

Hello @devmessias,

You are creating really nice tools. Recently when I use the title2bib to search for literature by title, it gives error like the following:

command: $title2bib 'Nanotwinned diamond with unprecedented hardness and stability'
error message:

Traceback (most recent call last):
  File "/usr/local/bin/title2bib", line 85, in <module>
	main()
  File "/usr/local/bin/title2bib", line 71, in main
	found, bib = get_bib_from_title(title, get_first)
  File "/usr/local/lib/python2.7/site-packages/title2bib/crossref.py", line 86, in get_bib_from_title
	found, item = get_from_title(title, get_first)
  File "/usr/local/lib/python2.7/site-packages/title2bib/crossref.py", line 50, in get_from_title
	items = r.json()["message"]["items"]
TypeError: list indices must be integers, not unicode

I am using python 2.7.15 on Mac OSX. The command works well a few weeks ago.

I also tried to update title2bib to version 0.4.0 using pip, but still have the issue.

Thanks a lot.

Libin

@kirk86
Copy link

kirk86 commented Feb 13, 2020

I can confirm getting kind of similar error

raceback (most recent call last):
  File "/home/user/bin/title2bib", line 85, in <module>
    main()
  File "/home/user/bin/title2bib", line 71, in main
    found, bib = get_bib_from_title(title, get_first)
  File "/home/user/lib/python3.7/site-packages/title2bib/crossref.py", line 86, in get_bib_from_title
    found, item = get_from_title(title, get_first)
  File "/home/user/lib/python3.7/site-packages/title2bib/crossref.py", line 50, in get_from_title
    items = r.json()["message"]["items"]
TypeError: list indices must be integers or slices, not str

@TjWallas
Copy link

I am also getting the same error. Any help here?

@wenlibin02
Copy link
Contributor Author

Try the quick fix in the recent pull request: 6789a4b

@kirk86
Copy link

kirk86 commented Feb 28, 2020

@wenlibin02 Does it work for you?

@wenlibin02
Copy link
Contributor Author

@wenlibin02 Does it work for you?

Yes, after I applied the code modification in the commit previously mentioned.

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