Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
173 views
in Technique[技术] by (71.8m points)

Returning a List type of variable from SSH in python

I am working on a project, which sends an image with to an Amazaon EC2 Instance via SCP and process the image via executing a python script inside the instance via SSH. The script has a return value in list type. How can i keep this value as a variable via Python in Client-Side. Sending the images via SCP and SSH is also done in a python script in Client-Side.

os.system(f'cmd /c "ssh -i pem-file.pem {instance} ./processing {image}"')

Thanks in Advance !

question from:https://stackoverflow.com/questions/65645947/returning-a-list-type-of-variable-from-ssh-in-python

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

try to read and use paramiko lib for ssh with python, you will find it easyer to get response back from the server directly to your script and not to the os.

paramiko site


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...