By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,907 Members | 1,963 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,907 IT Pros & Developers. It's quick & easy.

how to mount from python 2.6

P: 1
I am using python 2.6 on unix platform. I need to mount window drive from python. For that i done following code. But it does not get mounted.
Code is Here..........
Expand|Select|Wrap|Line Numbers
  1. import pexpect
  2. cmd2="sudo mount -t cifs //<ip address>/FinalWork  /mnt/win"
  3. child = pexpect.spawn(cmd2)
  4. i = child.expect([' password .* ', pexpect.EOF, pexpect.TIMEOUT])
  5. if i == 0:
  6.    print "******************sending pwd"
  7.    child.sendline(pwd) #Here pwd is password for sudo
  8.    print "+++++++++++given password : " + pwd
  9. elif i == 1:
  10.    print "--------------EOF"
  11. elif i == 2:
  12.    print "%%%%%%%%%%%%%%TIMEOUT"
  14. print "^^^^^^^^^^^^^^after pwd affair"
  15. child.close()
Please let me know where i gone wrong.
It's very urgent.
Thanks in advance.
Aug 30 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.