How to delete a file without an extension?
<p>I have made a function for deleting files:</p>

<pre><code>def deleteFile(deleteFile):
    if os.path.isfile(deleteFile):
        os.remove(deleteFile)
</code></pre>

<p>However, when passing a FIFO-filename (without file-extension), this is not accepted by the os-module.
Specifically I have a subprocess create a FIFO-file named 'Testpipe'.
When calling:</p>

<pre><code>os.path.isfile('Testpipe')
</code></pre>

<p>It results to <code>False</code>. The file is not in use/open or anything like that. Python runs under Linux.</p>

<p>How can you correctly delete a file like that?</p>

<p><code>isfile</code> checks for <em>regular</em> file.</p>

<p>You could workaround it like this by checking if it exists but not a directory or a symlink:</p>

<pre><code>def deleteFile(filename):
    if os.path.exists(filename) and not os.path.isdir(filename) and not os.path.islink(filename):
        os.remove(filename)
</code></pre>

python