<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 31 Jan 2021 at 12:39, Enrico Forestieri <<a href="mailto:forenr@lyx.org">forenr@lyx.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sun, Jan 31, 2021 at 04:22:39AM +0100, Thibaut Cuvelier wrote:<br>
> On Sat, 30 Jan 2021 at 12:26, Enrico Forestieri <<a href="mailto:forenr@lyx.org" target="_blank">forenr@lyx.org</a>> wrote:<br>
> > On Sat, Jan 30, 2021 at 05:31:05AM +0100, Thibaut Cuvelier wrote:<br>
> > > On Sat, 30 Jan 2021 at 02:31, Enrico Forestieri <<a href="mailto:forenr@lyx.org" target="_blank">forenr@lyx.org</a>> wrote:<br>
> > > ><br>
> > > > So, it seems that you have to check also for the 32-bit version.<br>
> > > ><br>
> > > Indeed. Would the attached patch solve the problem? I first look for a<br>
> > > 64-bit version before a 32-bit, just to favour newer things, but there is<br>
> > > no other reason to do so.<br>
> ><br>
> > The patch does not apply neither to current master nor to current stable<br>
> > (most probably it depends on previous patches):<br>
> ><br>
> > $ patch --dry-run -p1 <<br>
> > 0013-Configure-look-for-Java-in-the-registry-on-Windows.patch<br>
> > checking file lib/configure.py<br>
> > Hunk #1 FAILED at 330.<br>
> > Hunk #2 succeeded at 403 (offset -14 lines).<br>
> > Hunk #3 succeeded at 1923 (offset -94 lines).<br>
> > 1 out of 3 hunks FAILED<br>
> ><br>
> > and I had to apply it manually. Before applying it, I took away java from<br>
> > PATH and reconfigured:<br>
> ><br>
> > ...<br>
> > checking for a java interpreter...<br>
> > +checking for "java"...  no<br>
> > ...<br>
> ><br>
> > Correctly, java was not found (it is found when it is in PATH).<br>
> > Then I applied the patch an reconfigured again:<br>
> ><br>
> > ...<br>
> > checking for a java interpreter...<br>
> > +checking for "java"...  no<br>
> > Traceback (most recent call last):<br>
> >   File "C:\cygwin\win\python\lib\logging\__init__.py", line 870, in emit<br>
> >     stream.write(ufs % msg)<br>
> > LookupError: unknown encoding: cp65001<br>
> > Logged from file configure.py, line 346<br>
> > ...<br>
> ><br>
> > I have a native Windows version of Python 2.7 installed in<br>
> > "C:\cygwin\win\python".<br>
> ><br>
> > So, it seems there is a problem with Python 2<br>
> ><br>
> <br>
> I just tried with Python 2.7.18 (64 bits), I cannot reproduce your problem.<br>
> What is exactly on your line 346? I guess it is something like <a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>,<br>
> a line that runs without problem on my side (Python 3.8 and 2.7).<br>
<br>
Yes, that's exactly "<a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>('+checking for java: ' + java_bin)".<br>
It seems a problem related to the locale. I was reconfiguring from a<br>
cygwin shell, whose locale is UTF-8, apparently something alien to<br>
Windows. I now tried reconfiguring from a cmd.exe window and the result is:<br>
<br>
...<br>
checking for a java interpreter...<br>
+checking for "java"...  no<br>
+checking for java: C:\Program Files (x86)\Java\jre1.8.0_281\bin\java.exe<br>
...<br>
<br>
So, it works. However, to avoid confusion, you should avoid logging the<br>
first negative result. Or, maybe, on Windows report something like this:<br>
<br>
...<br>
checking for a java interpreter...<br>
+checking for "java" in PATH...  no<br>
+checking for "java" in registry... C:\Program Files (x86)\Java\jre1.8.0_281\bin\java.exe<br>
...<br>
<br>
And, yes, I know making things work for everyone is exhausting...<br>
<br>
Thank you for your efforts.<br></blockquote><div><br></div><div>Thank you for testing on your side :)! What's frustrating with your report is that this bug can only appear on Python 2, and that it will very likely be dropped for the next release (I remember seeing people wanting to keep it for LyX 2.4). Nevertheless, I'm trying to do a few things about it. <br></div><div><br></div><div>What I've been doing: change the output when looking for programs, with a more explicit "not in path" instead of "no", and the same for the registry check; convert the result of winreg.QueryValueEx to a string (in Python 2, it looks like it's a byte array, hence the error). If that doesn't work, I really don't know what to do, apart from not telling the user what Java binary was found.<br></div><div><br></div><div> I'm attaching a differential patch (unnamed8) for the latest changes, plus a complete updated patch that should replace the original 0013 patch. Does it work for you? <br></div><div><br></div><div><br></div><div><br></div><div>More generally, what about the other patches? Are formatting changes considered risky? What about Joel's suggestions? <br></div></div></div>