0

I am trying to use shlex library to run a curl command. I need to print out the errors. I have done the following but I dont see any errors.

import shlex
url='test.com'
args = shlex.split(url)

process = subprocess.Popen(args, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
print(stderr)

It is not pringing any errors. Any ideas?

user1471980
  • 10,127
  • 48
  • 136
  • 235
  • Firstly, the url variable is being assigned with an invalid string. The opening quote is a single quote while the closing quote is double. – Juicestus Dec 17 '21 at 02:51
  • 1
    Why are you running a `curl` command instead of just using python's `request` module? This question shows how much harder you're making it on yourself. – Barmar Dec 17 '21 at 02:53
  • if it doesn't display errors then maybe there is no errors - maybe it works correctly. Did you test the same command directly in shell? – furas Dec 17 '21 at 04:30

0 Answers0