Skip to content

Cannot overwrite attribute __setattr__ in class CompressionScanResult #586

@yusufalper

Description

@yusufalper

Installed sslyze with pip, When I try below code to start a scan(copying from docs), I am getting a error. I am not sure if this is library related but I can't fix it with trying again and again.

the code:

from sslyze import ServerScanRequest
from sslyze.server_setting import ServerNetworkLocation
from sslyze.errors import ServerHostnameCouldNotBeResolved

try:
    all_scan_requests = [
        ServerScanRequest(server_location=ServerNetworkLocation(hostname="cloudflare.com")),
        ServerScanRequest(server_location=ServerNetworkLocation(hostname="google.com")),
    ]
except ServerHostnameCouldNotBeResolved:
    # Handle bad input ie. invalid hostnames
    print("Error resolving the supplied hostnames")

the error:

Traceback (most recent call last):
  File "sslyze_test.py", line 1, in <module>
    from sslyze import ServerScanRequest
  File "local/lib/python3.7/site-packages/sslyze/__init__.py", line 23, in <module>
    from sslyze.plugins.scan_commands import ScanCommand
  File "local/lib/python3.7/site-packages/sslyze/plugins/scan_commands.py", line 8, in <module>
    from sslyze.plugins.compression_plugin import CompressionImplementation
  File "local/lib/python3.7/site-packages/sslyze/plugins/compression_plugin.py", line 35, in <module>
    CompressionScanResultAsJson = pydantic.dataclasses.dataclass(CompressionScanResult, frozen=True)
  File "pydantic/dataclasses.py", line 231, in pydantic.dataclasses.dataclass
    )
  File "pydantic/dataclasses.py", line 218, in pydantic.dataclasses.dataclass.wrap
    # When cls._FIELDS is filled in with a list of Field objects, the name
  File "python3.7/dataclasses.py", line 1010, in dataclass
    return wrap(_cls)
  File "python3.7/dataclasses.py", line 1002, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
  File "python3.7/dataclasses.py", line 963, in _process_class
    raise TypeError(f'Cannot overwrite attribute {fn.__name__} '
TypeError: Cannot overwrite attribute __setattr__ in class CompressionScanResult
  • OS: Amazon Linux EC2
  • Python version: python3.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions