No module named 'distutils.version'

Hello,

I am running into a crash in a script that used to work.

The script is this one I developed a few years ago and in Glyphs’ version 3.2 (3228) it started to throw this error:

  File "Character set builder (UI).py", line 23
    from drawBot import *
  File "_init_.py", line 1
    from .drawBotDrawingTools import _drawBotDrawingTool
  File "drawBotDrawingTools.py", line 10
    from .context import getContextForFileExt, getContextOptions, getFileExtensions, getContextOptionsDocs
  File "_init_.py", line 1
    from .pdfContext import PDFContext
  File "pdfContext.py", line 7
    from .baseContext import BaseContext, FormattedString
  File "baseContext.py", line 11
    from drawBot.macOSVersion import macOSVersion
  File "macOSVersion.py", line 1
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils.version'

As far as I see drawBot is looking for a macOSVersion that hasn’t a distutils.version declared. Does drawBot plugin need an update or is this something that can be fixed locally?

Thanks a lot,
Ricard.

What version of MacOS and python do you have? And can you try to update drawbot (by removing and re-installing it from the Plugin Manager)?

Hello Georg, MacOS is Ventura 13.6.1. I am running Glyphs 3.2 (3228) and updated drawbot and all modules from the Plugin Manager (by removing and re-installing them from the Plugin Manager).

ModuleNotFoundError: No module named ‘distutils’
App:3.2-3228 Plugin:0.0.6-10 System:13.6.1

I am who reported the problem to Ricard Garcia.
Thanks!

And what python version do you have? Can you check “Preferences > Addons” what is really selected?

The version selected is the 3.11.6 (Glyphs)

Hello! I am running into the same issue. My OS is Sonoma 14.2.1 (23C71), I have selected Glyphs for Python in preferences, and I am running the latest Glyphs version 3.2 (3234). I have also tested uninstalling and reinstalling Drawbot from the extensions manager a few times.

This somehow has to do with the python version. But I don’t know how.

Maybe this, from GitHub, is pertinent:
“The entire distutils package is deprecated, to be removed in Python 3.12. Its functionality for specifying package builds has already been completely replaced by third-party packages setuptools and packaging, and most other commonly used APIs are available elsewhere in the standard library (such as platform, shutil, subprocess or sysconfig). There are no plans to migrate any other functionality from distutils, and applications that are using other functions should plan to make private copies of the code.”

If that’s the case (sounds plausible indeed) then DrawBot needs an update. Maybe open an issue in their repo?

Glyphs is not yet using Python 3.12 I believe, but it will eventually. Which Python version is written in the Glyphs preferences?

@Mark Correct, but just checking Glyphs’ 11.6 and distutils have been removed there also based on the Readme.

I finally had time to look into this. Can you update the drawbot plugin and see if it works now.

1 Like

Thanks a lot Georg. It seems it is working now.