Posts

Showing posts from June, 2020

Can't find the code you're looking for? Just Suggest a Snippet and I'll add it :)

pysftp Host keys not found AWS PEM lightsail

If your using pysftp and your getting "host keys not found" error when trying to connect to instance, try the following: (note: the following assumes you have openSSH installed. Windows users will need to manually install this) 1. Open a terminal and navigate to the folder containing the .pem file. 2. Run : chmod 400 keyfile.pem   3. Use OpenSSH to ssh into your instance: ssh -i "keyfile.pem" USERNAME@IP_OF_INSTANCE And that's it! Your python script should work :) Example python script: import pysftp sftp = pysftp.Connection(host="INSTANCE_IP", username="USERNAME", private_key=r"../file.pem") See my full answer on stackoverflow for explanation :  htt

SNAPPED!

Find last element in python list

my_list[-1] SHARE OR SAVE FOR LATER SNAPPED!

SNAPPED!

Popular posts from this blog

Append to a json file python

Setup Mailhog mail server on Ubuntu