python code not working after copied from windows to linux -


i wrote small program in python, is:

#!/usr/bin/env python print "hello" 

it works in windows. , when type code in linux, works, too.

but when copy python file windows linux in vbox, code doesn't work, , error appears is:
: no such file or directory
why happen? , should fix it?

perhaps error because of different line endings on windows , linux? windows uses "\r\n" , linux "\n".

you write script rid of "\r" on linux, example:

edit: have realized carriage returns seen in binary mode. script should this

with open('myscript.py', 'rb') file:     data = file.read()     data = data.replace(b'\r\n', b'\n') open('myscript.py', 'wb') file:     file.write(data) 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -