pyicap
pyicap copied to clipboard
handle_one_request fails with error: AttributeError: module 'collections' has no attribute 'Callable'
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()
That suggested change works for Python 3.10.