This question already has an answer here:
- OSError: [Errno 2] No such file or directory while using python subprocess in Django 1 answer
I am currently writing a script for a customer.
This script reads from a config file. Some of these infos are then stores in variables.
Afterwards I want to use subprocess.call to execute a mount command So I am using these variables to build the mount command
call("mount -t cifs //%s/%s %s -o username=%s" % (shareServer, cifsShare, mountPoint, shareUser))
However this does not work
Traceback (most recent call last):
File "mount_execute.py", line 50, in <module>
main()
File "mount_execute.py", line 47, in main
call("mount -t cifs //%s/%s %s -o username=%s" % (shareServer, cifsShare, mountPoint, shareUser))
File "/usr/lib64/python2.6/subprocess.py", line 470, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib64/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/usr/lib64/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
buidling the command first with
mountCommand = 'mount -t cifs //%s/%s %s -o username=%s' % (shareServer, cifsShare, mountPoint, shareUser)
call(mountCommand)
also results in the same error.