Ubuntu 20.04下Inkscape相对路径被解析为家目录路径及GTK模块加载失败问题求助
Ubuntu 20.04下Inkscape相对路径被解析为家目录路径及GTK模块加载失败问题求助
大家好,我在Ubuntu 20.04上使用Inkscape时遇到了两个棘手的问题,想向大家求助:
一、相对路径被错误解析为家目录路径的问题
我已经在系统上安装了Inkscape,执行inkscape -V得到的版本信息如下:
Gtk-Message: 20:38:33.029: Failed to load module "canberra-gtk-module" Gtk-Message: 20:38:33.030: Failed to load module "canberra-gtk-module" Inkscape 1.3.2 (9e3d6414e7, 2024-01-14, custom)
我的需求是把SVG文件转换成PNG(测试时用了导出PDF的命令),但发现当使用相对路径指定文件时,Inkscape没有将其解析为相对于当前工作目录的路径,反而解析成了相对于家目录的路径。
比如执行这条命令:
inkscape ./mydrawing.svg --export-area-drawing --batch-process --export-type=pdf
会返回以下错误:
Gtk-Message: 20:42:58.054: Failed to load module "canberra-gtk-module" Gtk-Message: 20:42:58.056: Failed to load module "canberra-gtk-module" ** (org.inkscape.Inkscape:175089): WARNING **: 20:42:58.388: Can't open file: /home/myhome/mydrawing.svg (doesn't exist) ** (org.inkscape.Inkscape:175089): WARNING **: 20:42:58.388: Can't open file: /home/myhome/mydrawing.svg (doesn't exist) ink_file_open: '/home/myhome/mydrawing.svg' cannot be opened! InkscapeApplication::document_open: Failed to open: /home/myhome/mydrawing.svg ConcreteInkscapeApplication::on_open: failed to create document!
实际mydrawing.svg就在我执行命令的当前目录下,但Inkscape却去家目录找,导致文件无法打开。
二、GTK模块加载失败的警告问题
同时,每次执行Inkscape都会弹出Failed to load module "canberra-gtk-module"的警告,我尝试了以下几种解决方案:
sudo apt-get install libcanberra-gtk-module:i386sudo apt install -s --reinstall libcanberra-gtk-modulesudo apt install libcanberra-gtk-module libcanberra-gtk3-module
还试过相关问题下的所有解决方案,但都没能消除这个警告。我不确定这个警告是否是导致上述路径解析错误的原因。
补充环境信息
- 执行
type -a inkscape ; ls -l /etc/apt/sources.list.d的结果:inkscape is /snap/bin/inkscape total 0 - Snap安装的Inkscape版本情况:
返回:snap list inkscape --all
我也尝试过执行Name Version Rev Tracking Publisher Notes inkscape 1.3.2-9e3d6414e7-2024-01-14-cust 10563 latest/stable inkscape✓ disabled inkscape 1.3.1-9b9bdc1480-2023-11-25-cust 10555 latest/stable inkscape✓ -snap refresh --stable inkscape切换到1.3.1稳定版,但问题依旧存在。
有没有大佬知道这两个问题该怎么解决?尤其是相对路径解析错误的问题,现在根本没法正常处理当前目录下的文件,谢谢大家!
备注:内容来源于stack exchange,提问作者barej




