Skip to content

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

Open

Description

@wenlibin02

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

Activity

  1. kirk86 commented on Feb 13, 2020

    @kirk86

    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
    
    
  2. TjWallas commented on Feb 27, 2020

    @TjWallas

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

  3. wenlibin02 commented on Feb 28, 2020

    @wenlibin02
    ContributorAuthor

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

  4. kirk86 commented on Feb 28, 2020

    @kirk86

    @wenlibin02 Does it work for you?

  5. wenlibin02 commented on Feb 29, 2020

    @wenlibin02
    ContributorAuthor

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions