Updated patch for D2849
Called as a class, tested that did similar output to perl.
Differential D3213
tools/entity/checkref perl to python Stan on Dec 11 2020, 8:52 PM. Authored by Tags None Subscribers None
Details Updated patch for D2849 Called as a class, tested that did similar output to perl. See if it is enough.
Diff Detail
Event TimelineComment Actions Some questions, can we do it in parallel? Do you think tqdm would slow it a lot?
Comment Actions I get a new error now :/ I guess it's because it tries to open files with native encoding instead of UTF-8 Loading civs... Traceback (most recent call last): File "C:\Dev\trunk\source\tools\entity\checkrefs.py", line 478, in <module> check_ref.main() File "C:\Dev\trunk\source\tools\entity\checkrefs.py", line 61, in main self.add_civs() File "C:\Dev\trunk\source\tools\entity\checkrefs.py", line 368, in add_civs civ = load(f) File "C:\Python39\lib\json\__init__.py", line 293, in load return loads(fp.read(), File "C:\Python39\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 3419: character maps to <undefined> Also if I may, is it possible to have the prints as the script goes, instead of all when it fails? Maybe this is a windows bug? Comment Actions I don't know how your Windows console handles stdout, try with some print() and sleep() to reproduce eventually. I just did the minimum intervention, but it probably needs some refactoring and logging improvements. I don't know how often this is used and by whom for what ;-) Comment Actions Might be https://stackoverflow.com/questions/230751/how-to-flush-output-of-print-function will check and let you know Comment Actions Seems using import logging seems to work nicer on windows. Here is a naive implementation https://pastebin.com/4Rr067PW (you need to replace all the prints by their counter parts) The utf8 change did the trick. -t is still broken Traceback (most recent call last): File "C:\Dev\trunk\source\tools\entity\checkrefs.py", line 489, in <module> check_ref.main() File "C:\Dev\trunk\source\tools\entity\checkrefs.py", line 82, in main proc = run([str((Path(__file__).parent / '../xmlvalidator/validator.py').resolve())]) File "C:\Python39\lib\subprocess.py", line 501, in run with Popen(*popenargs, **kwargs) as process: File "C:\Python39\lib\subprocess.py", line 947, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Python39\lib\subprocess.py", line 1416, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, OSError: [WinError 193] %1 is not a valid Win32 application.
Comment Actions Nice! Will try to test it soon (not tonight as something came up) i think you forgot to remove the entity.pm file :) Comment Actions I saw a comment in the original ticket about deleting in another commit, in the first one I delete it. As you wish. Comment Actions Sorry it took me so long to reply. Well, for Entity PM if you now have 100% of the functionnality it is now useless. It seems validate.py is missing some support for variants. It seems it's also different from validate.pl, which we currently use. Any hope you could merge the functionnality? Seems rP24215 broke the script |