Skip to content

'filter' object has no attribute 'pop' #512

Closed

Description

@mrreyes512

In the export.py line 46

I'm getting the below error...

Traceback (most recent call last):
  File "export.py", line 84, in <module>
    main()
  File "export.py", line 56, in main
    view = views.pop()
AttributeError: 'filter' object has no attribute 'pop'

I'm calling it as illustrated below:

python export.py --csv --file export1.csv `report_ID`

Do i need to specify any further information?

Activity

  1. andrewbcooper commented on Jan 8, 2020

    @andrewbcooper

    I had the same issue and found this on Stackoverflow. Are you using Python 3.x? If so, edit the code to be:

    views = filter(lambda x: x.id == args.resource_id,
    TSC.Pager(server.views.get))
    views = list(views)
    view = views.pop()

    https://stackoverflow.com/questions/34820657/filter-object-has-no-attribute-pop

  2. JoeyKwok commented on Aug 18, 2020

    @JoeyKwok

    Mine returns 'IndexError: pop from empty list', using python 3.6 corrected with list.
    I am using view.id as report_ID. Am I using the correct one?

  3. bcantoni commented on Sep 1, 2020

    @bcantoni
    Contributor

    Confirmed this is still a bug in the sample. There are 2 issues here:

    • Making the sample work correctly in Python 3.x (as @andrewbcooper points out)
    • Better handling for the case where the resource_id is not found (as @JoeyKwok points out)
  4. jacalata commented on Jun 7, 2022

    @jacalata
    Contributor

    The updated samples should cover this nicely.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions