- 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()