Bad magic number

More or less, it looks like the .pyc file doesn’t match the python being used. The most common mechanism for fixing this is to remove the .pyc file and let python regenerate that file. But it looks like the .py file isn’t included within Glyphs.

Traceback (most recent call last):
  File "<string>", line 3, in <module>
ImportError: Bad magic number in /Applications/

As a note, it’s incredibly easy to reverse engineer a .pyc file…but it looks like you all have taken steps to prevent me from recreating the .pyc from a recreated .py file. Looking at the code, it appears you’re using python 2.6. I’m guessing that’s because Apple ships 2.6 with its OS. However, my best bet is that you’re actually using my /usr/local/bin or /usr/bin/env python, which won’t be 2.6 (I’m a full-time python developer).

Is there a way around this? I’d really like to explore the scripting, but the bug above is basically a non-starter for me.

I don’t do it to hide the code. We publish a copy of the files on github. The reason we ship the .pyc files is otherwise the automatically created ones will make the code signing of the whole app invalid.

What version of Glyphs do you have this problems with? And do you have installed a custom python?


Thank you so much for the quick response. I apologize, but I was actually confused about what I was working with. I have had Glyphs for a while and I didn’t realize that the version had been bumped up to 2.0. I’ve been using 1.45. After downloading the latest version and starting my trial period, everything is working splendidly.

That said, I have multiple python versions installed:
2.6.6 - system
2.7.14 - homebrew
3.6.4 - homebrew
3.7.x - built from github repo

What version of MacOS do you have? MacOS ships python 2.7 for some time. So if you have 2.6, then there is something wrong.
Did you update is recently? Then you might need to reinstall Glyphs 1.