Skip to content

[feaLib] Fails when running with multiprocessing #3762

@jenskutilek

Description

@jenskutilek

I'm compiling OTL features with feaLib (addOpenTypeFeaturesFromString) in a multiprocessing.Pool.

Whenever the feature compilation fails, I get this traceback instead of the location in the feature file where the error actually is:

Exception in thread Thread-3 (_handle_results):
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/threading.py", line 992, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/multiprocessing/pool.py", line 579, in _handle_results
    task = get()
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/multiprocessing/connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
TypeError: FeatureLibError.__init__() missing 1 required positional argument: 'location'

... and I need to quit manually (ctrl-c).

When I run it in a normal environment, the error is printed correctly, and the script exits:

File "site-packages/fontTools/feaLib/parser.py", line 349, in parse_glyphclass_
    raise FeatureLibError(
    ...<2 lines>...
    )
fontTools.feaLib.error.FeatureLibError: <features>:104:13: Unknown glyph class @_A_1st

How can I avoid the hanging process in multiprocessing, and get it to print the correct error message?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions