NameError: name 'file' is not defined
<p>This works in Python 2.7 but not in 3.5.</p>

<pre><code>def file_read(self, input_text):

    doc = (file.read(file(input_text))).decode('utf-8', 'replace')
</code></pre>

<p>I'm trying to open this file, input_text is a path value from argparse.</p>

<p>I get this error.</p>

<pre><code>NameError: name 'file' is not defined
</code></pre>

<p>I gather that Python 3.5 uses "open" instead of "file", but I don't quite get how to use open in a situation like this.</p>