× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Why does python os.path.isfile return false on windows, for only a specific directory?

Geoffrey Spear
Feb 02, 2015
<p>It's because '\t' is a tab character. Use forward slashes in your paths or use raw strings:</p> <pre><code>if os.path.exists('D:/testfiles/mysub/GraphiteController.js'): </code></pre> <p>or</p> <pre><code>if os.path.exists(r'D:\testfiles\mysub\GraphiteController.js'): </code></pre> <p>This tip was originally posted on <a href="http://stackoverflow.com/questions/21635230/Why%20does%20python%20os.path.isfile%20return%20false%20on%20windows,%20for%20only%20a%20specific%20directory?/21635297">Stack Overflow</a>.</p>
comments powered by Disqus