New submission from Vladimir <vmskou...@gmail.com>:

I have problem to run pyc file on one machine with Ubuntu Server 18.04.4 LTS.

This is my source code of the file:

#!/root/PycharmProjects/Project/venv/bin/python3.7
print("Hi")

When I compile it in python console with commands:

import py_compile
py_compile.compile('test2.py')

I get test2.cpython-37.pyc file. Then I add execution access by

chmod +x test2.cpython-37.pyc

If I run

./test2.cpython-37.pyc

on first machine (Ubuntu Server 18.04.4 LTS) I get simple "Hi".

But if I run similarly compiled file on other machine with the same OS - Ubuntu 
Server 18.04.4 LTS, I get:

./test2.cpython-37.pyc: line 1: $'B\r\r': command not found
./test2.cpython-37.pyc: line 2: syntax error near unexpected token `)'
./test2.cpython-37.pyc: line 2: `z�p^=�@s
                                          ed�dS)ZHiN)�print�rrtest2.py<module>�'

It looks like it is reading Windows line endings. But why? It is created, 
compiled and run on Ubuntu machine.

How can I solve this issue, and run this pyc file with the right result on 
second machine?

----------
messages: 364417
nosy: vladinko0
priority: normal
severity: normal
status: open
title: Windows line endings of pyc file detected on Ubuntu
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39992>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to