The document could not be saved.



  • It's worth mentioning this was an existing file I'd been saving with no issues then suddenly I got an issue that it cant save UFOs with the error message:

    The document “xx” could not be saved. The file isn’t in the correct format.

    Traceback:

    Traceback (most recent call last):
      File “lib/doodleDocument.pyc”, line 199, in writeSafelyToURL_ofType_forSaveOperation_error_
      File “lib/fontObjects/doodleFont.pyc”, line 215, in save
      File “/Applications/RoboFont.app/Contents/Resources/lib/python3.6/defcon/objects/font.py”, line 762, in save
      File “/Applications/RoboFont.app/Contents/Resources/lib/python3.6/defcon/objects/font.py”, line 796, in _saveInfo
      File “lib/fontObjects/doodleInfo.pyc”, line 11, in _set_dirty
    AttributeError: ‘NoneType’ object has no attribute ‘info’
    

  • admin

    Somehow something wrote a wrong value somewhere in the font.info, I know this is not helpful. This is not possible with the font info sheet as everything is either validated or normalised when setting into the font info.

    Does the font info sheet open for this font?

    You can test where it goes wrong or which attribute has the wrong value with this script:

    from fontTools.ufoLib import fontInfoAttributesVersion3
    # get the current font
    f = CurrentFont()
    
    # to test set a wrong value somewhere
    # f.naked().info.styleName = 1234
    
    # loop over all attributes
    for attr in fontInfoAttributesVersion3:
        # ignore the guidelines
        if attr == "guidelines":
            continue
        # get the attribute from font info
        getattr(f.info, attr)
    

    when # f.naked().info.styleName = 1234 is uncommented you should receive this error message:

    Traceback (most recent call last):
      File "<untitled>", line 6, in <module>
      File "info.py", line 38, in setter
        raise ValueError("Invalid value ({0}) for attribute {1}.".format(repr(value), name))
    ValueError: Invalid value (1234) for attribute styleName.
    

Log in to reply