We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm trying to use the anthropic-sdk on both Windows and macOS, but I'm encountering the following error on both platforms:
anthropic\_base_client.py:795 Message: AttributeError: module 'socket' has no attribute 'TCP_KEEPINTVL'
After investigating, I found that the socket.TCP_KEEPINTVL attribute isn't available on all platforms, particularly Windows and macOS.
To resolve the issue locally, I modified _base_client.py as follows:
if "transport" not in kwargs: socket_options = [ (socket.SOL_SOCKET, socket.SO_KEEPALIVE, True) ] if getattr(socket, 'TCP_KEEPINTVL', None) is not None: socket_options += [(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 60)] elif sys.platform == 'darwin': TCP_KEEPALIVE = getattr(socket, 'TCP_KEEPALIVE', 0x10) socket_options += [(socket.IPPROTO_TCP, TCP_KEEPALIVE, 60)] if getattr(socket, 'TCP_KEEPCNT', None) is not None: socket_options += [(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 5)] TCP_KEEPIDLE = getattr(socket, "TCP_KEEPIDLE", None) if TCP_KEEPIDLE is not None: socket_options.append((socket.IPPROTO_TCP, TCP_KEEPIDLE, 60))
With this change, the SDK works as expected on both platforms.
Would this be a valid fix to submit as a PR? Happy to open one if this approach looks good.
The text was updated successfully, but these errors were encountered:
I'm surprised you're seeing that error on macos, I was under the impression it was always available on macos 🤔
PR would be great, thank you!
Sorry, something went wrong.
@RobertCraigie Sure, created a PR #935
@RobertCraigie Please have a look at the PR.
No branches or pull requests
I'm trying to use the anthropic-sdk on both Windows and macOS, but I'm encountering the following error on both platforms:
After investigating, I found that the socket.TCP_KEEPINTVL attribute isn't available on all platforms, particularly Windows and macOS.
To resolve the issue locally, I modified _base_client.py as follows:
With this change, the SDK works as expected on both platforms.
Would this be a valid fix to submit as a PR? Happy to open one if this approach looks good.
The text was updated successfully, but these errors were encountered: