<p dir="auto">I recently updated to the new version of code (0.10.10) on OS X, and I was asked to remove an existing <code class="notranslate">code</code> alias I had set up in bash. I did so by modifying my <code class="notranslate">.bashrc</code> and then allowed code to apply its own. But the new one doesn't work after restarting code and bash:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ code
  File &quot;&lt;string&gt;&quot;, line 1
    import os,sys; print os.path.realpath(sys.argv[1])
                          ^
SyntaxError: invalid syntax
/usr/local/bin/code: line 10: ./MacOS/Electron: No such file or directory"><pre class="notranslate"><code class="notranslate">$ code
  File "&lt;string&gt;", line 1
    import os,sys; print os.path.realpath(sys.argv[1])
                          ^
SyntaxError: invalid syntax
/usr/local/bin/code: line 10: ./MacOS/Electron: No such file or directory
</code></pre></div>
<p dir="auto">Just installed 0.10.10 and installed the <code class="notranslate">code</code> shell command:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ code --help
  File &quot;&lt;string&gt;&quot;, line 1
    import os,sys; print os.path.realpath(sys.argv[1])
                          ^
SyntaxError: invalid syntax
/usr/local/bin/code: line 10: ./MacOS/Electron: No such file or directory"><pre class="notranslate"><code class="notranslate">$ code --help
  File "&lt;string&gt;", line 1
    import os,sys; print os.path.realpath(sys.argv[1])
                          ^
SyntaxError: invalid syntax
/usr/local/bin/code: line 10: ./MacOS/Electron: No such file or directory
</code></pre></div>
<p dir="auto">VS Code itself works fine if I launch it via Spotlight.</p>
<p dir="auto">I believe the problem is that I had a Python virtual environment active, and <code class="notranslate">python</code> points to Python 3. If I try <code class="notranslate">code</code> outside of that virtualenv, where <code class="notranslate">python</code> means Python 2, everything works fine.</p>
<p dir="auto">I guess the options are:</p>
<ol dir="auto">
<li>Make the launch script Python 2/3 compatible. (Step one would probably be to add <code class="notranslate">from __future__ import print_function</code> and update the <code class="notranslate">print</code> statements accordingly.)</li>
<li>Do some extra work to guarantee that you launch the system Python and not the user's configured Python, though this is probably not a viable long-term approach since distributions like Fedora now <a href="https://fedoraproject.org/wiki/Changes/Python_3_as_Default" rel="nofollow">default to Python 3</a> and don't even install Python 2 by default.</li>
</ol>