Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python automation
#4
Let's say I have two files, spam.py and eggs.py.

Here's spam.py:
import sys

for line in sys.stdin:
    print(line.upper())
And here's eggs.py:
import subprocess

process = subprocess.Popen("python ./spam.py", stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE, stdin=subprocess.PIPE)
output, errors = process.communicate(b'testing')
print(output)
Running eggs.py gives this output:
Output:
> python eggs.py b'TESTING\r\n'
Reply


Messages In This Thread
python automation - by newcode - Feb-04-2021, 11:14 AM
RE: python automation - by nilamo - Feb-04-2021, 08:37 PM
RE: python automation - by newcode - Feb-05-2021, 03:57 AM
RE: python automation - by nilamo - Feb-05-2021, 04:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Automation of GUI by python function dghosal 4 932 Aug-18-2023, 10:23 AM
Last Post: dghosal
  home automation using python barryjo 1 1,257 Jul-24-2022, 09:09 PM
Last Post: Larz60+
  Python Help, New User, Computer Automation hexagonalyeti 2 1,726 Jun-25-2021, 11:43 AM
Last Post: hexagonalyeti
  Automation using python Santhosh_Sangar 0 1,650 Mar-11-2020, 01:04 AM
Last Post: Santhosh_Sangar
  loop in pyautogui (python automation GUI application) pyprogrammer 0 4,888 Feb-12-2020, 02:52 PM
Last Post: pyprogrammer
  Python Based Data QA Automation tool suggestion Sonia567 1 2,046 Nov-19-2019, 04:46 PM
Last Post: Larz60+
  Create hybrid automation framework using python. janeho 2 2,482 Mar-20-2019, 05:27 PM
Last Post: DeaD_EyE
  Python automation GET/POST/REQUEST Raki 1 3,138 Sep-22-2017, 06:24 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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