python code not working after copied from windows to linux
<p>I just wrote a small program in python, which is:</p>

<pre><code>#!/usr/bin/env python
print "hello"
</code></pre>

<p>It works in windows. And when I type this code in linux, it works, too.</p>

<p>But when I copy the python file from windows to linux in my VBox, this code doesn't work, and an error appears which is:<br/>
: no such file or directory<br/>Why does that happen? And what should I do to fix it?</p>

<p>Perhaps you get an error because of different line endings on windows and linux? Windows uses "\r\n" and Linux just "\n". </p>

<p>You could write script that would get rid of "\r" on linux, for example:</p>

<p>EDIT: I have realized that carriage returns are seen only in binary mode. So script should do something like this</p>

<pre><code>with open('myscript.py', 'rb') as file:
    data = file.read()
    data = data.replace(b'\r\n', b'\n')
with open('myscript.py', 'wb') as file:
    file.write(data)
</code></pre>

python linux windows