Assignment 6 - RuntimeError: Bad magic number in .pyc file

127 views
Skip to first unread message

Brendan Saw

unread,
Dec 8, 2020, 2:03:08 AM12/8/20
to cmpt-295-sfu
SFU ID: bsaw
Github username: brendansaw
Question: I've followed the errata instructions on the assignment #6 homework page, however I've noticed that simply calling wget with the python file doesn't work as it is unable to establish the SSL connection. However, I've circumvented this issue by adding extra parameters. Then, using this decrypt.pyc file that I've just obtained, when I try to run the instructions at the bottom of the homework page, I encounter the following message: "RuntimeError: Bad magic number in .pyc file". Perhaps the version of Python that I have could be an issue? I'm running Python 3.8.5.

Capture-295-Assignment6.PNG

b.minh96

unread,
Dec 9, 2020, 1:59:38 PM12/9/20
to cmpt-295-sfu
I suspect that this issue is caused by the python version you're running. Usually you cannot run the compiled bytecode .pyc generated from older python version with a newer python version.
If you run this command : "file decrypt.pyc".
You'll see that the python version that generates this pyc is 3.6 and you cannot run it with 3.8.
Try python 3.6 instead

ashrir...@gmail.com

unread,
Dec 9, 2020, 9:38:40 PM12/9/20
to cmpt-295-sfu

You appear to be using your own VM? 
 You need to have python 3.6 or this wont work.
SSL errors etc these are all related to your VM.
Reply all
Reply to author
Forward
0 new messages