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
  • 698,132
  • 130
  • 858
  • 1,229
ganeshredcobra
  • 1,488
  • 3
  • 26
  • 41

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
  • 15,632
  • 2
  • 45
  • 66