The current 2.6.4 version of pysolfc crashes at startup on new install of FreeBSD 13.0 with pysolfc Traceback (most recent call last): File "/usr/local/bin/pysolfc", line 36, in <module> from pysollib.main import main # noqa: E402,I202 File "/usr/local/lib/python3.8/site-packages/pysollib/main.py", line 30, in <module> from pysollib.app import Application File "/usr/local/lib/python3.8/site-packages/pysollib/app.py", line 31, in <module> from pysollib.gamedb import GAME_DB, GI, loadGame File "/usr/local/lib/python3.8/site-packages/pysollib/gamedb.py", line 28, in <module> from pysollib.mfxutil import Struct, print_err File "/usr/local/lib/python3.8/site-packages/pysollib/mfxutil.py", line 146, in <module> uclock = time.clock AttributeError: module 'time' has no attribute 'clock' This was reported to upstream in "https://github.com/shlomif/PySolFC/issues/145" as an incompatibility with python 3.8 and is fixed in newer versions.
Created attachment 225684 [details] pysolfc-fix-runtime-with-py38.patch (In reply to sven.a.jonsson from comment #0) Hi, thank you for the report! Can you please try the attached patch? It should fix the issue with "clock.time", that was removed in Python 3.8. An update to 3.10.1 is not entirely trivial and requires more work than I currently have time because.
^ Triage: Set maintainer-feedback and merge-quarterly (version in 2021Q2 branch is also affected) flags accordingly, adding external reference from comment #0 to "See also".
Thank you so much for your quick response! I have just applied the attached patch and built and installed pysolfc using synth, and I can verify that it appears to be fully functional.
I am experiencing the exact same issue. I applied the patch and reinstalled the port and still the problem remains. I checked the file /usr/local/lib/python3.8/site-packages/pysollib/mfxutil.py and the patch changes do seem to be there... This is how the changed section of mfxutil.py looks now, after patching... # high resolution clock() and sleep() uclock = time.clock usleep = time.sleep if os.name == "posix": uclock = time.time But, I still get the same errors as before patching. So, I am not sure if there's a problem with the patch or perhaps I've done something wrong.... I am running FreeBSD 13.0-RELEASE-p2 (amd64) and pysolfc 2.6.4_1 Any thoughts or suggestions of what I could try next?
(In reply to Christopher from comment #4) It seems you are still running the old version. The updated version should be 2.6.4_2.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=91cf30435554dda6bf71dc566f91352dd469d816 commit 91cf30435554dda6bf71dc566f91352dd469d816 Author: Kai Knoblich <kai@FreeBSD.org> AuthorDate: 2021-06-30 08:31:41 +0000 Commit: Kai Knoblich <kai@FreeBSD.org> CommitDate: 2021-06-30 08:41:15 +0000 games/pysolfc: Fix runtime issues with Python 3.8+ * The deprecated function "time.clock()" has been removed in Python 3.8 and "time.perf_counter()" should be used instead. Because updating to a newer version of PySolFC requires a bit more work, use a backport for now to remedy the runtime issues. * Bump PORTREVISION due changed package contents. PR: 256504 Reported by: <sven.a.jonsson@bahnhof.se> MFH: 2021Q2 games/pysolfc/Makefile | 2 +- games/pysolfc/files/patch-pysollib_mfxutil.py (new) | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-)
A commit in branch 2021Q2 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=cb3b365038fcaee997eb9e4006a7e2bfed6e5ab0 commit cb3b365038fcaee997eb9e4006a7e2bfed6e5ab0 Author: Kai Knoblich <kai@FreeBSD.org> AuthorDate: 2021-06-30 08:31:41 +0000 Commit: Kai Knoblich <kai@FreeBSD.org> CommitDate: 2021-06-30 08:56:01 +0000 games/pysolfc: Fix runtime issues with Python 3.8+ * The deprecated function "time.clock()" has been removed in Python 3.8 and "time.perf_counter()" should be used instead. Because updating to a newer version of PySolFC requires a bit more work, use a backport for now to remedy the runtime issues. * Bump PORTREVISION due changed package contents. PR: 256504 Reported by: <sven.a.jonsson@bahnhof.se> MFH: 2021Q2 (cherry picked from commit 91cf30435554dda6bf71dc566f91352dd469d816) games/pysolfc/Makefile | 2 +- games/pysolfc/files/patch-pysollib_mfxutil.py (new) | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-)
(In reply to Christopher from comment #4) > This is how the changed section of mfxutil.py looks now, after patching... > > # high resolution clock() and sleep() > uclock = time.clock > usleep = time.sleep > if os.name == "posix": > uclock = time.time The mfxutil.py file seems unchanged. It should contain the following lines if succesfully patched: > try: > uclock = time.perf_counter > except Exception: > uclock = time.clock Anyway, the attached patch has been committed and was merged into the 2021Q2 branch as well and games/pysolfc should work as usual. Please let me know, if there are still issues.
(In reply to sven.a.jonsson from comment #3) The runtime fix has been committed and was merged into the 2021Q2 branch as well. Thank you for the report and the quick feedback!