#๐Ÿ”’ os.system

16 messages ยท Page 1 of 1 (latest)

lone spindle
#

what is the difference between os.system and the various methods of subproccess? also, what are the differences between the subproccess methods? and overall, what is the best?

edgy harnessBOT
#

@lone spindle

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

lone spindle
#

hello?

wide sparrow
#

reading stdin/out or subprocess being written to return stuff i think

lone spindle
#

what

dim wigeon
lone spindle
#

os.system just runs a command in a subshell and gives you the return status code
no does not

#

try running ```py
print(os.system("cd"))

dim wigeon
lone spindle
#

it printed the location

dim wigeon
#

no it did not. thats probally what cd with no arguments does on windows, but the print itself should print 0. it cant return a string - it returns an int.

lone spindle
#

oh right

#

yes

#

sorry that was a stupid question

edgy harnessBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.