Skip to content
Snippets Groups Projects
Commit 795efd19 authored by las1g21's avatar las1g21
Browse files

Added Sending Files and Connect to Iridis

parent 8b140465
No related branches found
No related tags found
1 merge request!9GDP 4.4.5
......@@ -2,3 +2,4 @@ scripts/360monodepthexecution/rgb.jpg
scripts/shifted_t.png
scripts/config.ini
*.pyc
.env
\ No newline at end of file
mona-ssc @ a0816610
Subproject commit a0816610da9fa1ed52674240d8343b5643f0e25c
import paramiko
from dotenv import load_dotenv
from scp import SCPClient
import os
load_dotenv()
hostname = os.getenv("HOSTNAME")
username = os.getenv("USERNAME")
password = os.getenv("PASSWORD")
def send_files(shifted_disparity_path, shifted_t_path):
command = [
"scp",
shifted_disparity_path,
f"{username}@{hostname}:{os.getenv("REMOTE_INPUT_PATH")}"
]
try:
subprocess.run(command, check=True)
except subprocess.CalledProcessError as e:
print(f"Error during SCP: {e}")
return False
command = [
"scp",
shifted_t_path,
f"{username}@{hostname}:{os.getenv("REMOTE_INPUT_PATH")}"
]
try:
subprocess.run(command, check=True)
except subprocess.CalledProcessError as e:
print(f"Error during SCP: {e}")
return False
return True
def get_completed_scene(shifted_disparity_path, shifted_t_path):
if send_files(shifted_disparity_path, shifted_t_path):
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
# Connect to the server
client.connect(hostname, username=username, password=password)
# Execute commands on the server
stdin, stdout, stderr = client.exec_command("ls -l")
print("AHAHAHAHAHAHAH\n")
# Print the output of the command
print(stdout.read())
# Close the SSH connection
client.close()
else:
return False
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment