Bug 1816428

Summary: does not launch: mfxutil.py:146 module 'time' has no attribute 'clock'
Product: [Fedora] Fedora Reporter: Paul Dufresne <dufresnep>
Component: PySolFCAssignee: Shlomi Fish <shlomif>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 32CC: fredferickson, jaromir.capik, sergio, shlomif
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: PySolFC-2.8.0-2.fc32 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-06 00:15:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paul Dufresne 2020-03-24 00:18:26 UTC
Description of problem:
pysol does not launch, returning a python error

Version-Release number of selected component (if applicable):
PySolFC-2.6.4-9.fc32.noarch

How reproducible:
each launch

Steps to Reproduce:
1. install https://kojipkgs.fedoraproject.org/compose/branched/Fedora-32-20200323.n.0/compose/Labs/x86_64/iso/Fedora-Games-Live-x86_64-32-20200323.n.0.iso os a USB key
2. boot with it, in live mode
3. open a terminal
4. pysol

Actual results:
[liveuser@localhost-live ~]$ pysol
Traceback (most recent call last):
  File "/usr/share/PySolFC/pysol.py", line 36, in <module>
    from pysollib.main import main  # noqa: E402,I202
  File "/usr/lib/python3.8/site-packages/pysollib/main.py", line 30, in <module>
    from pysollib.app import Application
  File "/usr/lib/python3.8/site-packages/pysollib/app.py", line 31, in <module>
    from pysollib.gamedb import GAME_DB, GI, loadGame
  File "/usr/lib/python3.8/site-packages/pysollib/gamedb.py", line 28, in <module>
    from pysollib.mfxutil import Struct, print_err
  File "/usr/lib/python3.8/site-packages/pysollib/mfxutil.py", line 146, in <module>
    uclock = time.clock
AttributeError: module 'time' has no attribute 'clock'


Expected results:
game window appearing

Additional info:
fixed upstream

Comment 1 Paul Dufresne 2020-03-24 00:49:18 UTC
So the following workaround works for me:
sudo sed -i 's/uclock = time.clock/uclock = time.perf_counter/g' /usr/lib/python3.8/site-packages/pysollib/mfxutil.py

Comment 2 Paul Dufresne 2020-03-24 00:51:39 UTC
Although the correct patch is more like:
try:
    uclock = time.perf_counter
except Exception:
    uclock = time.clock

Comment 3 Shlomi Fish 2020-03-24 08:04:34 UTC
(In reply to Paul Dufresne from comment #2)
> Although the correct patch is more like:
> try:
>     uclock = time.perf_counter
> except Exception:
>     uclock = time.clock

Thanks for the report. There is a duplicate, but locked, report from abrt.

I updated PySolFC's version to the new stable upstream one here: https://src.fedoraproject.org/rpms/PySolFC . It contains the fix, but I lack the permissions to submit it into fedora 32 and fedora rawhide.

sergio: can you please review my changes and submit them?

Comment 4 Fedora Update System 2020-03-27 16:44:02 UTC
FEDORA-2020-cf4aaebe0d has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-cf4aaebe0d

Comment 5 Sergio Basto 2020-03-27 16:47:48 UTC
*** Bug 1815310 has been marked as a duplicate of this bug. ***

Comment 6 Sergio Basto 2020-03-27 16:59:38 UTC
(In reply to Shlomi Fish from comment #3)
> sergio: can you please review my changes and submit them?

Sorry I missed this message, done. You need submit an update on 
https://bodhi.fedoraproject.org/ if you login with with same fas user of src.fedoraproject.org , I think I have the permissions ... 

Thanks

Comment 7 Paul Dufresne 2020-03-27 19:40:06 UTC
The new package installed from bodhi, allows me to start and play the game fine...
But searching it in the Gnome, I now see that the icon is empty, making it hard to find.

Doing:
sudo dnf remove PySolFC
sudo dnf install PySolFC
then the icon come back... but do not launch (obviously).

I also see that it is also an upgrade from 2.6.4 to 2.6.8.

I also see rpmling giving a lot of errors for using shebang lines with env python:
https://taskotron.fedoraproject.org/artifacts/all/be95a31c-6e6e-11ea-9431-525400364adf/tests.yml/PySolFC-2.8.0-1.fc32.log
but I just don't know how you are supposed to handle those.

Comment 8 Paul Dufresne 2020-03-27 19:50:42 UTC
Also missing the new changelog?
         "module" : "SpecFileSanity",
         "order" : 5,
         "results" : [
            {
               "code" : "ChangelogBadVersion",
               "context" : {
                  "excerpt" : [
                     "* Tue Jan 28 2020 Fedora Release Engineering &lt;releng&gt; - 2.6.4-9"
                  ],
                  "lineno" : 77,
                  "path" : "PySolFC.spec"
               },
               "diag" : "First %changelog entry is for <var>2.6.4-9</var>; I was expecting <var>2.8.0</var> as the version, not 2.6.4"
            }

Sorry if I care to much for the details!

Comment 9 Paul Dufresne 2020-03-27 20:25:13 UTC
I have created bug #1818150 about the shebang lines.

Comment 10 Fedora Update System 2020-03-28 14:59:30 UTC
FEDORA-2020-cf4aaebe0d has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-cf4aaebe0d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-cf4aaebe0d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2020-03-28 17:59:34 UTC
FEDORA-2020-cf4aaebe0d has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-cf4aaebe0d

Comment 12 Fedora Update System 2020-03-29 01:41:48 UTC
FEDORA-2020-cf4aaebe0d has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-cf4aaebe0d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-cf4aaebe0d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2020-04-06 00:15:55 UTC
FEDORA-2020-cf4aaebe0d has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.