This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: .pyc file not running in cross python versions
Type: crash Stage: resolved
Components: Build Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ammar2, princykatlana
Priority: normal Keywords:

Created on 2020-08-27 16:11 by princykatlana, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg376003 - (view) Author: Princy katlana (princykatlana) Date: 2020-08-27 16:11
When I tried to compile the python source code from python version 3.5 and run the .pyc file on python version 3.6 then it shows the following exception: 
RuntimeError: Bad magic number in .pyc file
msg376004 - (view) Author: Ammar Askar (ammar2) * (Python committer) Date: 2020-08-27 16:17
.pyc files aren't meant to be portable, they contain raw bytecode and data specific to the version of Python they were compiled on. For example, search for "Changed in version 3.6" here and you'll see all the little changes to the bytecode format: https://docs.python.org/3/library/dis.html

You'll have to compile your python source code on 3.6 if you intend to run it on a 3.6 interpreter.
History
Date User Action Args
2022-04-11 14:59:35adminsetgithub: 85816
2020-08-27 16:17:57ammar2setstatus: open -> closed

nosy: + ammar2
messages: + msg376004

resolution: not a bug
stage: resolved
2020-08-27 16:11:57princykatlanacreate