1

I am trying to write a script to copy files from one flash drive to another using Python along with Zenity UI. Variables Sorz_star and Desz contains path to two flash drives.

subprocess.call('cp -R %s %s |zenity --progress --text "Copying" --pulsate --auto-close'%(Sorz_star,Desz), shell=True)

This works fine in terminal but when I use this command in my copy.py file it shows this error

sh: 2: Syntax error: "|" unexpected
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
ganeshredcobra
  • 1,881
  • 3
  • 28
  • 44

1 Answers1

2

One or both of the substituted variables probably ends with a newline. Use .strip() on them to remove it.

David K. Hess
  • 16,632
  • 2
  • 49
  • 73