Python Forum

Full Version: execute linux command with arguments
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
import subprocess
myname=raw_input("myname=")
subprocess.call(["pvcreate","/dev/",myname])
Output:
[[email protected] siva]# python test1.py myname=sdc Device /dev/ not found. Device sdc not found.
we are getting this error,but we can created with commands
Try '/dev/' + myname. When you write /dev/sdc on the command line, it is a single argument.
now it's working fine.
Thanks