fonttools in Catalina

Mark Simonson
Mark Simonson Posts: 1,736
edited October 2019 in Type Design Software
I've upgraded to Catalina. It's been fine overall, but I just discovered today that fonttools is not working when I call it from a script. I can see it in the Python directory, and ttx still works from the command line. But if I try to run a script that calls fonttools, it says it's not defined. It seems that Python doesn't know about it anymore, and I'm not sure how to fix it.

Has anyone run into this, and if so how to fix it?

Comments

  • Viktor Rubenko
    Viktor Rubenko Posts: 119
    edited October 2019
    What about other non-standard packages?
    Mb you have installed fonttools to system python and try to call it with python from python.org?
  • I'm using the system Python (2.7.16). (Pre-Catalina, it was 2.7.10.) I don't really use any other non-standard packages, although it looks like a few were installed at some point (e.g. vanilla). None of these seem to be known by Python, either.
  • It's not recommended to use system python.
    Try to install some popular packages like numpy or lxml and import them. If you get this error again, then there is a problem in the installation path.
    You can also try:
    python -m pip install fonttools
  • No pip either. System Python has always worked for me in the past. Has this changed?
  • Viktor Rubenko
    Viktor Rubenko Posts: 119
    edited October 2019
    If you really want to use system python, you can try to install pip 
    https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py
    and then install fonttools with pip
    But a more preferable and easy way is to install python from python.org and work with it.
  • Thomas Phinney
    Thomas Phinney Posts: 2,889
    edited October 2019
    No pip either. System Python has always worked for me in the past. Has this changed?
    Yes, it has!

    FontTools 4.x, which just came out in August (I think), requires Python 3.6 or later. Current version is 4.0.2.

    FontTools 3.x works with Python 2.7 or later, including the 2.7.16 that comes with macOS Catalina.
  • Mark Simonson
    Mark Simonson Posts: 1,736
    edited October 2019
    Hm. Looks like I'll just have to reinstall FontTools. Apparently, I was using version 2.3 before. I'm not sure if it's possible (or advisable) to use that on Catalina.

    Fortunately, I haven't upgraded my laptop to Catalina yet, so I can run my scripts there until I get this sorted out.

    Is it worth moving to FontTools 4.x? Will it break scripts that are based on earlier versions?
  • Mark Simonson
    Mark Simonson Posts: 1,736
    edited October 2019
    Never mind. It turns out the problem was trying to run the script from BBEdit.

    Pre-Catalina, I always used Textmate to run scripts. But the version of Textmate I was using wasn't 32-bit, so I figured I could just use BBEdit instead. The error I was getting made me think it was something to do with Catalina. But the problem is something to do with the way BBEdit runs Python scripts.

    There may be a way to get BBEdit to work, but the simpler solution was to download a more recent version of Textmate. Works fine now. Duh.

    Sorry for taking your time.

    Update: I guess BBEdit requires "#!/usr/bin/env python" at the top of the script. Apparently, Textmate somehow assumes that if it's a .py file.