Skip to content

handle_one_request fails with error: AttributeError: module 'collections' has no attribute 'Callable' #43

Description

@Mirraz

handle_one_request fails with error:

Exception occurred during processing of request from ('192.168.100.14', 50518)
Traceback (most recent call last):
  File "/usr/lib/python3.10/socketserver.py", line 683, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.10/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.10/socketserver.py", line 747, in __init__
    self.handle()
  File "/tmp/pyicap/examples/../pyicap.py", line 470, in handle
    self.handle_one_request()
  File "/tmp/pyicap/examples/../pyicap.py", line 518, in handle_one_request
    if not isinstance(method, collections.Callable):
AttributeError: module 'collections' has no attribute 'Callable'

I am using python3.10

Suggesting this fix:

--- a/pyicap.py
+++ b/pyicap.py
@@ -515,7 +515,7 @@ class BaseICAPRequestHandler(StreamRequestHandler):
                 raise ICAPError(404)
 
             method = getattr(self, mname)
-            if not isinstance(method, collections.Callable):
+            if not callable(method):
                 raise ICAPError(404)
             method()
             self.wfile.flush()

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions