python: UnboundLocalError: local variable 'open' referenced before assignment
<pre><code>def read_lines():
    readFileName = "readfile.txt"
    f = open(readFileName, 'r+')
    contents = f.read()
        ... # and so on 

read_lines()
</code></pre>

<p>When I run this, I get an error:</p>

<pre><code>f = open(readFileName, 'r+')
UnboundLocalError: local variable 'open' referenced before assignment
</code></pre>
