listerrors fails
José Abílio Matos
jamatos at lyx.org
Mon Sep 28 10:16:33 UTC 2020
On Monday, September 28, 2020 8:51:40 AM WEST Kornel Benko wrote:
> Our python script lib/scripts/listerrors fails with the message
> File "./listerrors", line 25
> from __future__ import print_function
> ^
> SyntaxError: from __future__ imports must occur at the beginning of the file
> Exit 1
>
> Since we require python3 here, this line is not needed IMHO
We do not, at least not for 2.4.
The reason why we have the shebang as
#!/usr/bin/python3
is that if we want to run the script alone we can do it using that binary.
That is useful for testing only.
AFAIR all the scripts are called from lyx using the chosen python version.
> Removing this line, and using on the make-log I get
> Traceback (most recent call last):
> File "lib/scripts/listerrors", line 162, in <module>
> main()
> File "lib/scripts/listerrors", line 70, in main
> if predicate(line): break
> File "lib/scripts/listerrors", line 77, in noweb_try
> if string.find(line, ": unescaped << in documentation chunk") != -1:
> AttributeError: module 'string' has no attribute 'find'
This is a script that has been almost untouched and so it still has these nice
memories. In particular the methods like find and others are available as
strings (the objects not the module) since python 2.0 released in 16 October
2000.
The module methods were removed in python 3 since they were redundant.
> (master & branch 2.3.x)
>
> Kornel
I have submitted a change that should fix this both in python 2 and python 3.
And as you correctly describe above the only change when we switch to python 3
only will be to remove the "from __future__ ..." line that is a no-op in
python 3.
Tell me if this fixes listerrors for you.
Regards,
--
José Abílio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200928/dfca47e4/attachment.html>
More information about the lyx-devel
mailing list