Paramiko and Indigo 2023.2

Posted on
Tue Apr 23, 2024 9:46 am
Different Computers offline
User avatar
Posts: 2558
Joined: Jan 02, 2016
Location: East Coast

Paramiko and Indigo 2023.2

https://www.paramiko.org says it works in python 3.11. But the following script gets
Code: Select all
 Script Error                    trigger "Motion in the Garden" embedded script error:
   Script Error                    No module named 'paramiko'
   Script Error                    Exception Traceback (most recent call shown last):

     embedded script, line 7, at top level
ModuleNotFoundError: No module named 'paramiko'


I'm running pip 24.0 from /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip (python 3.10)

But Indigo uses 3.11? I think my confusion here is the root of the problem. There's a "Important Note" about running the pip3 install again in the download docs, but apparently I'm in the wrong place for that upgrade. Do I need to run the pip3 install somewhere besides the regular Mac OS command line?

Here's the script that throws the error.

Code: Select all
from datetime import datetime
from pathlib import Path
from PIL import Image, ImageDraw, ImageFont
import matplotlib.pyplot as plt
import numpy as np
import time
import paramiko

image_path = Path(indigo.server.getInstallFolderPath()) / "Web Assets" / "public"
target_image = "redact.jpg"

time.sleep(0.5)

with Image.open(image_path / target_image) as original:
    draw = ImageDraw.Draw(original)
    font = ImageFont.truetype("Arial", 55)
    draw.text((55, 23), datetime.now().strftime("%a %d %I:%M %p " + target_image.split(".")[0]), (255, 70, 90), font=font)
    plt.subplot(1, 2, 1)
    plt.title("white text")
    # plt.imshow(original)
    original.save(image_path / target_image, optimize=True, quality=45)
    original.save(image_path / "alert.jpg", optimize=True, quality=45)
# create SSH client
ssh = paramiko.SSHClient()

# add server's key to the list of known hosts
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

# connect to the server using password authentication
ssh.connect(hostname='192.redact', username='redact', password='redact')

# open SFTP session
sftp = ssh.open_sftp()

# upload the file
sftp.put(image_path / target_image, '/redactedjpg')
sftp.put(image_path / target_image, '/redacted/redactede.jpg')

# close SFTP session
sftp.close()

# close SSH connection
ssh.close()

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Tue Apr 23, 2024 9:48 am
FlyingDiver offline
User avatar
Posts: 7229
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Paramiko and Indigo 2023.2

If you're using Indigo 2023.2, which uses Python 3.11. then you should not have Python 3.10 installed at all. Delete /Library/Frameworks/Python.framework/Versions/3.10 completely, then re-run the Indigo installer to make sure Python 3.11 is installed correctly.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Apr 23, 2024 9:53 am
Different Computers offline
User avatar
Posts: 2558
Joined: Jan 02, 2016
Location: East Coast

Re: Paramiko and Indigo 2023.2

anything I need to know before taking a command line machete to that directory? Is there a safer, python based method of deleting 3.10?

Found a couple of guides online that said rm -fr /Library/Frameworks/Python.framework/Versions/x.x would work fine. Looks like I'm ok.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Tue Apr 23, 2024 10:09 am
Different Computers offline
User avatar
Posts: 2558
Joined: Jan 02, 2016
Location: East Coast

Re: Paramiko and Indigo 2023.2

So I did all that, and after I get
Code: Select all
 Script Error                    trigger "Vehicle or a deer in the driveway" embedded script error:
   Script Error                    No module named 'paramiko'
   Script Error                    Exception Traceback (most recent call shown last):

     embedded script, line 7, at top level
ModuleNotFoundError: No module named 'paramiko'


So I ran pip3 install paramiko and now it's working. Thanks!

That was all a lot.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests