Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automate MML Commands
#9
The code should change. The previous one too.

I just showed you how you can loop over the commands and them. The moment I posted my answer though it crossed my mind that you have to connect successfully before anything else. But I was in a hurry to correct it.

So before the for loop, on a single line of code just use the subprocess module to connect to the server then you can loop.

REMOTE_ADDRESS = '192.168.1.113'

proc = subprocess.run(['ssh', REMOTE_ADDRESS])

if proc.returncode == 1:
    # loop over commands here
A return code 0 means that the command executed successfully with no errors - or we have 0 errors literally. You are connected.
saisankalpj likes this post
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
Automate MML Commands - by saisankalpj - Oct-27-2022, 07:46 AM
RE: Automate MML Commands - by wavic - Oct-27-2022, 08:26 AM
RE: Automate MML Commands - by saisankalpj - Oct-27-2022, 09:48 AM
RE: Automate MML Commands - by saisankalpj - Oct-31-2022, 06:31 AM
RE: Automate MML Commands - by wavic - Oct-27-2022, 10:48 AM
RE: Automate MML Commands - by saisankalpj - Oct-27-2022, 01:42 PM
RE: Automate MML Commands - by wavic - Oct-27-2022, 02:04 PM
RE: Automate MML Commands - by saisankalpj - Oct-27-2022, 02:30 PM
RE: Automate MML Commands - by wavic - Oct-31-2022, 08:15 AM
RE: Automate MML Commands - by saisankalpj - Nov-09-2022, 12:46 PM
RE: Automate MML Commands - by saisankalpj - Dec-06-2022, 01:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  1. How can I automate this batch creation of documents? 2. How can I automate posting SamLearnsPython 2 3,522 Jul-02-2018, 11:36 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020