2

I am trying to create and download a new SSH key using boto, as in this question, and I am using the steps outlined in this answer:

key_cass = conn.create_key_pair('cassandra_keypair')
key_cass.save('path/to/folder/'.encode('utf-8'))

In this case, it tells me that:

TypeError: Can't mix strings and bytes in path components

When I remove the explicit encoding:

key_cass.save('path/to/folder/')

I get:

TypeError: 'str' does not support the buffer interface

If it helps, I am using boto version 2.36.0 on Python 3.4.3.

Community
  • 1
  • 1
tchakravarty
  • 10,736
  • 12
  • 72
  • 116

1 Answers1

0

Its mainly because you are using Python 3.x

In Python 3.x, String is not the same type as for Python 2.x

related question

Solution 1 : Run it in Python 2.x

Solution 2 : Use some typecasting for the same

Hope it helps..

Community
  • 1
  • 1
Roshan
  • 1,380
  • 13
  • 23
  • Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Bhargav Rao Jun 22 '16 at 06:06
  • @BhargavRao I've updated the answer, i'm new to stack overflow, please review the answer. Let me know any changes needs to be done – Roshan Jun 22 '16 at 06:24