当前位置:网站首页>【踩坑】Win11 WSL2 中 meld 无法正常使用问题修复
【踩坑】Win11 WSL2 中 meld 无法正常使用问题修复
2022-04-23 05:47:00 【mightbxg】
Win11 中已经默认使用 wslg 来显示 WSL2 中的 GUI,不再需要额外开启 Xserver,这个确实是很方便实用的功能,但目前(2021.12)似乎还不是特别完美。我在体验的过程中就遇到了一个比较蛋疼的问题:meld 比较文件时出现异常。
meld 是一个开源的用于比较文件/文件夹的工具,类似 Beyond Compare。它可以设置为 git merge.tool,从而用于解决 git 合并时的冲突。之前 Win10+WSL2+Xserver 环境中用 meld 一直都没遇到任何问题,但在 Win11 中却会报一堆错:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/meld/diffgrid.py", line 34, in do_realize
self._handle1.realize(self)
File "/usr/lib/python3/dist-packages/meld/diffgrid.py", line 270, in realize
attr.cursor = Gdk.Cursor.new_for_display(widget.get_display(),
TypeError: constructor returned NULL
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/meld/diffgrid.py", line 46, in do_map
self._handle1.set_visible(True)
File "/usr/lib/python3/dist-packages/meld/diffgrid.py", line 288, in set_visible
self._window.show()
AttributeError: 'NoneType' object has no attribute 'show'
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/meld/diffgrid.py", line 201, in do_size_allocate
self._handle1.set_visible(mapped and wlink1 > 0)
File "/usr/lib/python3/dist-packages/meld/diffgrid.py", line 288, in set_visible
self._window.show()
AttributeError: 'NoneType' object has no attribute 'show'
...
这个问题我目前还没有在网上找到相关的解决方法,看起来是 GTK 的问题,最接近的一个帖子是:TypeError constructor returned NULL in wayland session。正巧 wslg 使用的也是 wayland,抱着试一试的心态,我打开 /usr/lib/python3/dist-packages/meld/diffgrid.py,将其中第 270 行改成:
#attr.cursor = Gdk.Cursor.new_for_display(widget.get_display(),
# Gdk.CursorType.
# SB_H_DOUBLE_ARROW)
attr.cursor = Gdk.Cursor.new_from_name(widget.get_display(), "col-resize")
再次测试,一切正常~~
版权声明
本文为[mightbxg]所创,转载请带上原文链接,感谢
https://blog.csdn.net/mightbxg/article/details/121954380
边栏推荐
猜你喜欢

Motor and drive (Qi Jinqing Edition)

如何安装jsonpath包

安装pyshp库
scikit-learn sklearn 0.18 官方文档中文版

Rust的闭包类型(Fn, FnMut, FnOne的区别)

解决ArcGIS分区统计显示太多唯一值执行失败
![[untitled] database - limit the number of returned rows](/img/20/9a143e6972f1ce2eed5a3d11c3a46d.png)
[untitled] database - limit the number of returned rows

Class inheritance and derivation

【UDS统一诊断服务】二、网络层协议(2)— 数据传输规则(单帧与多帧)

Storing inherited knowledge in cloud computing
随机推荐
爬虫之requests基本用法
The waterfall waterfall flow of uview realizes single column and loads more
GDAL+OGR学习
C#中?的这种形式
[untitled] database - limit the number of returned rows
渔网道路密度计算
Robocode教程4——Robocode的游戏物理
爬取彩票数据
识别验证码
Database - sorting data
多线程爬取马可波罗网供应商数据
Linux 用rpm的方式安装mysql(超简单)
Rust的闭包类型(Fn, FnMut, FnOne的区别)
搭建openstack平台
Detailed arrangement of knowledge points of University probability theory and mathematical statistics
How SYSTEMd uses / etc / init D script
Matlab标定板角点检测原理
相机标定:关键点法 vs 直接法
C语言数组处理批量数据
Rust:如何实现一个线程池?