package fig2dev with inkscape on macos (avoiding error on open/import)
Inkscape 1.0.2 displays an error on Open/Import of Xfig (
*.fig) format files on macOS 10.15. Open/Import is supported by an extension (see: fig_input.py; fig_input.inx), and this appears to be a problem with calling the extension. An additional, possibly related, issue is that the
XFIG Graphics File (*.fig) file type filter item is missing from the Open/Import dialog when Inkscape is launched from the Finder.
Xfig format remains relevant because, despite its age, Xfig can still run on modern systems (see: http://mcj.sourceforge.net/) but it is showing its age. Inkscape is one of the few viable alternative vector graphics editors because it will open Xfig files.
Steps to reproduce:
- Launch Inkscape from the Finder.
Cmd-O). The Open dialog is displayed.
All filesin the file type filter popup menu in the bottom right of the dialog window.
- Navigate to a directory containing an Xfig (
.fig) format file.
- Open the
.figfile by double-clicking on the file in the dialog, or select the
.figfile and click the open button.
An error dialog
Failed to load the requested file <path to file>
Note: If Inkscape is opened from the command line with with
open -a Inkscape then, prior to the error dialog above, an additional dialog is displayed containing a Python traceback:
Inkscape has received additional data from the script executed.
The script did not return an error, but this may indicate the results will not be as expected.
Traceback (most recent call last): File "fig_input.py", line 35, in <module> FigInput().run() File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/base.py", line 139, in run self.load_raw() File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/extensions.py", line 110, in load_raw document = load_svg(document) File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/elements/_base.py", line 80, in load_svg return etree.ElementTree(etree.fromstring(stream, parser=SVG_PARSER)) File "src/lxml/etree.pyx", line 3237, in lxml.etree.fromstring File "src/lxml/parser.pxi", line 1891, in lxml.etree._parseMemoryDocument ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.
Additionally, Inkscape's "Select file to open" and "Select file to import" dialogs do not consistently show an
XFIG Graphics File (*.fig) item in the file type filter popup menu. It doesn't appear when Inkscape is launched from the Dock or Finder, but does appear when Inkscape is launched from the command line with
open -a Inkscape. When opened from the command line, Inkscape will also show
.fig files in the Open/Import dialog with the default file type filter
All Inkscape Files but when launched from the Finder Inkscape does not show these files in the dialog.
What should have happened?
Inkscape should have opened the Xfig file without error.
Sample attachments: crazyarch.fig
- Inkscape Version: 1.0.2 (e86c8708, 2021-01-15)
- Operating System: macOS
- Operating System version: 10.15.7 (Catalina)