Stavo cercando di utilizzare il sottoprocesso chiamate a eseguire un'operazione di copia (codice qui sotto):Python sottoprocesso Errore nel usando "cp"
import subprocess
pr1 = subprocess.call(['cp','-r','./testdir1/*','./testdir2/'], shell = True)
ed ho ottenuto un errore che dice:
cp: missing file operand
Try `cp --help' for more information.
Quando provo con shell=False
, ottengo
cp: cannot stat `./testdir1/*': No such file or directory
Come faccio a risolvere questo problema?
sto usando RedHat Linux GNOME Deskop versione 2.16.0 e shell bash e Python 2.6
P.S. Ho letto la domanda ha postato in Problems with issuing cp command with Popen in Python, ed è suggerito di utilizzare shell = True
opzione, che non funziona per me, come ho già detto :(
Buona spiegazione. Mi ha aiutato a capire cosa stava succedendo. – morganw09dev