Python Forum
Need help reducing some code around a subprocess
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help reducing some code around a subprocess
#4
(Jun-11-2019, 10:42 PM)snippsat Wrote: Can show one with run() that has gotten new parameters like capture_output=True.
name = subprocess.run(['id', '-un'], encoding='utf8', capture_output=True)

I tried this, but it gave me something that doesn't look like an error, but also not what I was looking for :P

Output:
CompletedProcess(args=['id', '-un'], returncode=0, stdout='username\n', stderr='')
But Gribouillis proposal worked, so are gonna mark the thread as solved.

Thank you both for your help and time!
Reply


Messages In This Thread
RE: Need help reducing some code around a subprocess - by anistorian - Jun-12-2019, 02:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Reducing runtime memory usage in Cpython interpreter david_the_graower 2 2,289 Oct-18-2021, 09:56 PM
Last Post: david_the_graower
  Reducing JSON character count in Python for a Twitter Bot johnmitchell85 2 61,541 Apr-28-2021, 06:08 PM
Last Post: johnmitchell85
  fraction module: can you stop the reducing? qmfoam 1 2,464 Oct-10-2020, 06:10 PM
Last Post: bowlofred
  output list reducing each time through loop 3Pinter 6 3,599 Mar-19-2019, 01:31 PM
Last Post: perfringo
  Reducing code length xavier992 4 4,529 Jul-22-2017, 12:45 AM
Last Post: xavier992

Forum Jump:

User Panel Messages

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