Popen.returncode not working in Python?
<p>I have a price of code which transfers file from server to local machine. However, the directory the user enters may not be always correct. If the user enters the incorrect directory I am trying to show the error. If the <code>returncode</code> is not None I will show the error. But this doesn't work. No matter what the program throws it always go to <code>else</code> part. </p>

<pre><code>#!/usr/bin/python

import subprocess



result = subprocess.Popen(['sshpass', '-p', 'password', 'rsync', '-avz', '--info=progress2', 'username@host_name:/file_name', '/home/zurelsoft/test'], 
                                    stdout=subprocess.PIPE)

if result.returncode != None:
    print "Directory Incorrect"

else:
    print "Done"
    print result
</code></pre>
