Skip to content

ImportError: cannot import name 'ForbiddenResource' from 'twisted.web.error' #8

@brandon-biggs

Description

@brandon-biggs

Hi,

It appears that the twisted package may have changed a little bit since authrevproxy.py was written. When installing versions of Twisted at least >= 20.3.0, I was getting the error

File "authrevproxy.py", line 14, in <module>
    from twisted.web.error import ForbiddenResource
ImportError: cannot import name 'ForbiddenResource' from 'twisted.web.error'

The solution to this seemed to be to update where ForbiddenResource was being imported from. It appears that it now needs to be imported from twisted.web.resource instead of twisted.web.error. Here is the file that led me to this solution - https://github.com/twisted/twisted/blob/trunk/src/twisted/web/resource.py

Hopefully this helps if someone else runs into a similar issue.

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