Re: Reverse search with Skim broken again
> On Jun 2, 2019, at 2:50 AM, Enrico Forestieri wrote: > > On Sat, Jun 01, 2019 at 02:30:30PM -0700, list_em...@icloud.com wrote: >> >> I found the problem—it was a broken LyX pipe or something like that. >> (I don’t understand this well.) I discovered that when LyX quit it was >> leaving .lyxpipe.in and .lyxpipe.out and the LyX wiki says that these >> should be deleted when LyX quit. >> >> How did I figure this out? I was using BibDesk (Mac GUI for BibTeX) >> and the “Send to LyX” command. It failed with a very specific error >> dialog about the LyX pipe. So I figured that Skim must do something >> similar. >> >> Is it possible to have LyX also provide a helpful error dialog when >> there are pipe problems instead of just failing quietly? > > LyX detects dangling pipes on start and automatically deletes them. > I don't know why this mechanism was not working for you. > > -- > Enrico I don’t either, but thanks for the answer. Jerry
Re: How to signal missing citation
> On Jun 4, 2019, at 07:37, Pavel Sanda wrote: > > Hi, > > could we make missing citation warning somehow more visible > when they happen? We detect them from the log already, > but we just color them in latex output window. > > I would like to have something more disturbing - > e.g. red exlamation mark in status line (or better idea?). > > We actually don't need even the latex run, the citation > inset already shows ?? in case something went south, > so we could use that info. > > Opinions? > > Pavel I would love to see a differently colored cross-reference and citation button for when such entries are broken. I also think a “show anyway” error on view is warranted for broken citations, similar to when no citations are entered. Thanks, Joel
Re: Problem with Python 3.6.6
On Tuesday, 4 June 2019 07.43.18 WEST Guenter Milde wrote: > It *may* be required with Python 3.1, 3.2, 3.3, or 3.4. > Unfortunately, I don't know whether `output` is of type "bytes" or > "str" with this versions. > > If we can establish, that `output` is of type "str" in all Python versions > that are supported by LyX, we can remove the complete sequence: > > - if not PY2: > -# Ensure we have a (unicode) string object in Python3 > -# (not required for version >= 3.5). > -# FIXME: Check whether this is required with any supported 3.x version! > -output = str(output) > > > Günter And I agree with your analysis. os.popen always returns a (unicode) string. The original code is mine. My original thought was that popen would return bytes and not strings. That is wrong as I found when looking to the python source code. Looking the os.py file we can see that: proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, bufsize=buffering) return _wrap_close(io.TextIOWrapper(proc.stdout), proc) and the io.TextIOWrapper uses by default (this case) the default encoding of the system. That code is there since, at least, python 3.2 and so for all practical purposes it has been there for python. So I will remove this code because it is a no-op. One advantage is that the code is then common between python2 and python3. :-) Thank you. :-) -- José Abílio
How to signal missing citation
Hi, could we make missing citation warning somehow more visible when they happen? We detect them from the log already, but we just color them in latex output window. I would like to have something more disturbing - e.g. red exlamation mark in status line (or better idea?). We actually don't need even the latex run, the citation inset already shows ?? in case something went south, so we could use that info. Opinions? Pavel
Re: Problem with Python 3.6.6
On 2019-06-03, José Abílio Matos wrote: > On Tuesday, 26 February 2019 12.15.06 WEST Guenter Milde wrote: >> In any case, os.popen is deprecated since Python 2.6 and should be replaced >> by calls to subprocess. https://docs.python.org/3/library/subprocess.html > That is true but in a sense there is no need because according to the python > documentation: > https://docs.python.org/3/library/os.html#os.popen > "This is implemented using subprocess.Popen; see that class’s documentation > for more powerful ways to manage and communicate with subprocesses." Yes, there is no mention of a deprecation in the current Python docs so we can assume it is safe to use in cases we don't need the "more powerful ways". Fine. > In any case it would be nice to make the python code uniform and > following the best practices. Yes (see my other reply). Günter
Re: Problem with Python 3.6.6
On 2019-06-03, José Abílio Matos wrote: > On Thursday, 28 February 2019 22.03.48 WEST Guenter Milde wrote: >> >> diff --git a/lib/scripts/convertDefault.py >> >> b/lib/scripts/convertDefault.py >> >> index 8678965013..c7db4f5499 100644 >> >> --- a/lib/scripts/convertDefault.py >> >> +++ b/lib/scripts/convertDefault.py >> >> @@ -35,7 +35,10 @@ if fout.close() != None: >> >> output = fout.readline() >> >> fout.close() >> >> if not PY2: >> >> -output = output.decode() >> >> +# ensure we have a (unicode) string object in Python3 >> >> +# FIXME: not required for version >= 3.5 >> >> +#check whether this is required with any supported 3.x >> >> version! +output = str(output) > Hi Günter, > today I tried to find why the fix is required for python >= 3.5 but > after an exhaustive look into python documentation I found no > reference. > Do you remember what is the reason for that? There was a failure due to calling "output.decode()". The commit message says: At least since Python 3.5, `output` is already a (unicode) string and does not have a "decode" method. In Python 2, after fout = os.popen('magick -version 2>&1') output = fout.readline() `output` is an ordinary "bytes" string. A "bytes" string can be converted to a "unicode" string with: a) unicode(output) # Python 2 rsp. str(output) # Python 3 b) output.decode() c) * The .decode() method has the advantage that you can specify the encoding (not required in this case) but fails if the object is already of type "unicode" (Python 2) rsp. "str" (Python 3). * Method a) fails in Python 3, because 'unicode' is not defined (it is now called "str"). * Method c) fails in Python 3 (there is no implicit conversion from "bytes" to "str"). This is probably the reason for the pre-fix code: if not PY2: output = output.decode() The post-fix code if not PY2: output = str(output) is failsafe (it does not fail if `output` is already a (unicode) "str" object). It could be replaced with the one-liner output = str(output) because this does not fail with Python 2 either. OTOH, the "post-fix" code has no effect with Python 2 `output` is a "bytes" string, before and after Python 3.5 and above `output` is a "unicode" string, before and after. It *may* be required with Python 3.1, 3.2, 3.3, or 3.4. Unfortunately, I don't know whether `output` is of type "bytes" or "str" with this versions. If we can establish, that `output` is of type "str" in all Python versions that are supported by LyX, we can remove the complete sequence: - if not PY2: -# Ensure we have a (unicode) string object in Python3 -# (not required for version >= 3.5). -# FIXME: Check whether this is required with any supported 3.x version! -output = str(output) Günter