question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError during sock.sendall("CONNECT %s HTTP/1.0\r\n" % host)

See original GitHub issue

I am trying to launch a cluster with:

toil launch-cluster --zone eu-central-1c --keyPairName aws --leaderNodeType t2.micro cactus --logDebug

But keep getting the following error:

Traceback (most recent call last):
  File "/cactus/env/bin/toil", line 11, in <module>
    sys.exit(main())
  File "/cactus/env/lib/python3.7/site-packages/toil/utils/toilMain.py", line 25, in main
    module.main()
  File "/cactus/env/lib/python3.7/site-packages/toil/utils/toilLaunchCluster.py", line 154, in main
    awsEc2ExtraSecurityGroupIds=config.awsEc2ExtraSecurityGroupIds)
  File "/cactus/env/lib/python3.7/site-packages/toil/provisioners/aws/awsProvisioner.py", line 153, in launchCluster
    profileArn = kwargs.get('awsEc2ProfileArn') or self._getProfileArn()
  File "/cactus/env/lib/python3.7/site-packages/toil/provisioners/aws/awsProvisioner.py", line 95, in wrapper
    return f(*args, **kwargs)
  File "/cactus/env/lib/python3.7/site-packages/toil/provisioners/aws/awsProvisioner.py", line 652, in _getProfileArn
    iamRoleName = self._ctx.setup_iam_ec2_role(role_name=_INSTANCE_PROFILE_ROLE_NAME, policies=policy)
  File "/cactus/env/lib/python3.7/site-packages/toil/lib/context.py", line 535, in setup_iam_ec2_role
    "Action": ["sts:AssumeRole"]}
  File "/cactus/env/lib/python3.7/site-packages/boto/iam/connection.py", line 1155, in create_role
    return self.get_response('CreateRole', params)
  File "/cactus/env/lib/python3.7/site-packages/boto/iam/connection.py", line 85, in get_response
    response = self.make_request(action, params, path, verb)
  File "/cactus/env/lib/python3.7/site-packages/boto/connection.py", line 1117, in make_request
    return self._mexe(http_request)
  File "/cactus/env/lib/python3.7/site-packages/boto/connection.py", line 914, in _mexe
    self.is_secure)
  File "/cactus/env/lib/python3.7/site-packages/boto/connection.py", line 705, in get_http_connection
    return self.new_http_connection(host, port, is_secure)
  File "/cactus/env/lib/python3.7/site-packages/boto/connection.py", line 747, in new_http_connection
    connection = self.proxy_ssl(host, is_secure and 443 or 80)
  File "/cactus/env/lib/python3.7/site-packages/boto/connection.py", line 797, in proxy_ssl
    sock.sendall("CONNECT %s HTTP/1.0\r\n" % host)
TypeError: a bytes-like object is required, not 'str'

Any ideas where to start debugging?

┆Issue is synchronized with this Jira Task ┆Issue Number: TOIL-598

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
adamnovakcommented, Aug 21, 2020

This looks like the problem solved by https://github.com/boto/boto/pull/3699/ to upstream boto. The Boto folks never merged it because they abandoned boto and moved all their devs to boto3.

I think to fix this we either need to fork boto and fix it or migrate the relevant AWS calls to boto3.

0reactions
adamnovakcommented, Aug 21, 2020

We could also monkey patch boto to get around the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError during sock.sendall("CONNECT %s HTTP/1.0\r\n ...
Describe the bug I am trying to launch a toil cluster. It uses boto to interact with AWS. Traceback (most recent call last):...
Read more >
TypeError: a bytes-like object is required, not 'str' while trying ...
But, as the error says, socket.send expects a bytes-like object. ... url = input("Enter a web address and press Enter: ") s.connect((url, ...
Read more >
Handling socket errors gracefully - Second Edition
The Python socket library has an elegant method of handing these errors via the socket.error exceptions. In this recipe, a few examples are...
Read more >
Sockets Tutorial with Python 3 part 1 - PythonProgramming.net
A socket will be tied to some port on some host. In general, you will have either a client or a server type...
Read more >
Socket Programming in Python (Guide)
In this in-depth tutorial, you'll learn how to build a socket server and ... SOCK_STREAM) as s: s.connect((HOST, PORT)) s.sendall(b"Hello, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found