<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi all:<br>
    <blockquote>i have some doubts in doing python programming<br>
      <br>
      i wanted to execute a command "su -c 'fdisk -l'",and it needed a
      password<br>
      so i wanted to write a python script to get this done.<br>
      <br>
      i knew 'pexpect' would work fine,but i had to set a certain
      timeout to take care of the real delay time which i probably
      didn't know<br>
      <br>
      i tried to use 'subprocess' to do this,however,it did not work
      well,and came the problem<br>
      <br>
      i use Popen to execute "su -c 'fdisk -l'" in sub process,and
      assigned subprocess.PIPE to stdin,stdout<br>
      i tried to enter password by doing "stdin.write("password"+"\n")"
      and i expected i could get the output of "fdisk -l" by doing
      "stdout.read()"<br>
      it didn't work.<br>
      <br>
      will somebody tell me what is going on with that?<br>
      i'll appreciate i can learn from you<br>
      <br>
      Dou<br>
    </blockquote>
  </body>
</html>