<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
mso-ligatures:none;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link="#0563C1" vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal>Bug <a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1034878">#1034878</a> - <a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1034878">meld gives python traceback if run as root</a> is caused by the call to Gtk.Settings.get_default() in settings.py at about line 56.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>This code still exists in the head of the git repo.<br><br><o:p></o:p></p><p class=MsoNormal>As per the PyAPI manual at https://lazka.github.io/pgi-docs/Gtk-3.0/classes/Settings.html#Gtk.Settings.get_default . If Gtk is not initialised (which often happens when you sudo root over a remote shell as you need to pass xauth) then the call to Gtk.Settings.get_default() will fail and return None. This is not handled.<br>The issue is that a couple lines down instead of referencing Gtk.Setting.props it now looks for (None).props….. and breaks as per the bug report. Something like following two/four lines are required, though that is really only a partial fix, as this will eliminate the Python error as per the bug, but meld will still die horribly this time with a Gtk error, rather than exit gracefully while informing the user.<br>I don’t know enough about Gtk or meld to fix that.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><br><span style='font-family:"Courier New"'> gtk_settings = Gtk.Settings.get_default()<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'> > # get_default() returns None if there is no graphics, <o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'> > # even if the user has settings in their profile<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'> > if gtk_settings is None:<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'> > return<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'> prefer_dark = settings.get_boolean(key)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'> gtk_settings.props.gtk_application_prefer_dark_theme = prefer_dark</span><br><br>Cheers,<o:p></o:p></p><p class=MsoNormal>Jay (the-moog at github)<o:p></o:p></p></div></body></html>