Convert .py files to correct encoding for Python 3
<p>I just pulled from a git repo where the users are on Python 2. My system is running Python 3 and with no changes in the code, I am getting this error:</p>

<pre><code>TabError: inconsistent use of tabs and spaces in indentation
</code></pre>

<p>It appears that the solution is to change the char set encoding of the <code>.py</code> files, but working in emacs, I'm not clear how to do this. I'm seeing these instructions:</p>

<p><a href="https://www.emacswiki.org/emacs/ChangingEncodings" rel="nofollow">https://www.emacswiki.org/emacs/ChangingEncodings</a></p>

<p>but I don't understand how to apply these for utf-8. I'd appreciate any suggestions.</p>

<p>Exists a command <code>untabify</code>:</p>

<p>Convert all tabs in region to multiple spaces, preserving columns.
If called interactively with prefix ARG, convert for the entire
buffer.</p>

<p>I.e. call it with C-u to convert all TABs in buffer.</p>

<p>As comment points out correctly: <code>tabify</code> does the inverse, converts multiple spaces to tabs - while using spaces seems a common convention not just in Python.</p>

python encoding emacs