os.path.isfile() returns false for file on network drive
<p>I am trying to test if a file exists on the network drive using os.path.isfile however it returns false even when the file is there. Any ideas why this might be or any other methods I could use to check for this file?</p>

<p>I am using Python2.7 and Windows10</p>

<p>This returns true as it should:</p>

<pre><code>import os

if os.path.isfile("C:\test.txt"):
    print "Is File"
else:
    print "Is Not File"
</code></pre>

<p>This returns false even though the file exists:</p>

<pre><code>import os

if os.path.isfile("Q:\test.txt"):
    print "Is File"
else:
    print "Is Not File"
</code></pre>

<p>From python <a href="https://docs.python.org/2/library/os.path.html" rel="nofollow">https://docs.python.org/2/library/os.path.html</a>: </p>

<blockquote>
  <p>The os.path module is always the path module suitable for the operating system Python is running on, and therefore usable for <strong>local paths</strong></p>
</blockquote>

<p>Trying using the full UNC path instead of the mapped drive.</p>

<pre><code>import os

if os.path.isfile(r"\\full\uncpath\test.txt"):
    print "Is File"
else:
    print "Is Not File"
</code></pre>

python python-2.7