I have a problem with the following code:
import subprocess
process = subprocess.run(
['mkdir', 'hola'], stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True
)
print(process.stderr)
print(process.stdout)
It does not create the "hello" folder, but the strange thing is that the process gives the following error:
b"mkdir: falta un operando\nPruebe 'mkdir --help' para m\xc3\xa1s informaci\xc3\xb3n.\n" # print(process.stderr)
It's like passing it as the first parameter ['mkdir']
instead of ['mkdir', 'hola']
, but I don't know.
Also try the following: ['cp', 'file1.txt', 'file2.txt']
and something similar happened:
b"cp: falta un fichero como operando\nPruebe 'cp --help' para m\xc3\xa1s informaci\xc3\xb3n.\n"
What's going on? (a few days ago, it worked fine... and I have no idea why it doesn't work now)