PySolFC icon indicating copy to clipboard operation
PySolFC copied to clipboard

Failed to run in Fedora 43

Open lyokha opened this issue 2 months ago • 9 comments

On recently installed Fedora 43, I get the error:

$ pysol
pygame 2.6.1 (SDL 2.32.56, Python 3.14.0)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/usr/share/PySolFC/pysol.py", line 41, in <module>
    sys.exit(main(sys.argv))
             ~~~~^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/pysollib/main.py", line 473, in main
    app.mainloop()
    ~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/site-packages/pysollib/app.py", line 195, in mainloop
    approc = self.mainproc()  # setup process
  File "/usr/lib/python3.14/site-packages/pysollib/app.py", line 389, in mainproc
    self.setTile(self.tabletile_index, force=True)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/pysollib/app.py", line 692, in setTile
    if self.scrolled_canvas.setTile(self, i, scaling, force):
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/pysollib/tile/tkwidget.py", line 556, in setTile
    if not self.canvas.setTile(tile.filename, stretch, save_aspect):
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/pysollib/ui/tktile/tkcanvas.py", line 330, in setTile
    self.setBackgroundImage()
    ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/site-packages/pysollib/ui/tktile/tkcanvas.py", line 190, in setBackgroundImage
    sw, sh = self._geometry()
             ~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/site-packages/pysollib/ui/tktile/tkcanvas.py", line 202, in _geometry
    w = int(self.cget('width'))
ValueError: invalid literal for int() with base 10: '10c'

There were no errors in Fedora 42.

lyokha avatar Oct 29 '25 20:10 lyokha

Trying to reproduce this issue. Can you confirm which version of PySolFC you're using?

joeraz avatar Oct 31 '25 00:10 joeraz

This was shipped as rpm package in Fedora 43.

$ pysol --version
PySol FC version 3.4.0
$ rpm -qi PySolFC
Name        : PySolFC
Version     : 3.4.0
Release     : 5.fc43
Architecture: noarch
Install Date: Wed Oct 29 02:40:05 2025
Group       : Unspecified
Size        : 78942654
License     : GPL-2.0-or-later
Signature   :
              RSA/SHA256, Sat Sep 20 07:55:51 2025, Key ID 829b606631645531
Source RPM  : PySolFC-3.4.0-5.fc43.src.rpm
Build Date  : Sat Sep 20 01:10:00 2025
Build Host  : buildvm-ppc64le-04.rdu3.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : https://pysolfc.sourceforge.io
Bug URL     : https://bugz.fedoraproject.org/PySolFC
Summary     : A collection of solitaire card games
Description :
PySolFC is a collection of more than 1000 solitaire card games. It is a fork
of PySol solitaire. Its features include modern look and feel (uses Tile widget
set), multiple card-sets and tableau backgrounds, sound, unlimited undo, player
statistics, a hint system, demo games, a solitaire wizard, support for user
written plug-ins, an integrated HTML help browser, and lots of documentation.

lyokha avatar Oct 31 '25 10:10 lyokha

The rpm changelog if it can help:

$ rpm -q -changelog PySolFC | head -15
* Fri Sep 19 2025 Python Maint <[email protected]> - 3.4.0-5
- Rebuilt for Python 3.14.0rc3 bytecode

* Fri Aug 15 2025 Python Maint <[email protected]> - 3.4.0-4
- Rebuilt for Python 3.14.0rc2 bytecode

* Wed Jul 23 2025 Fedora Release Engineering <[email protected]> - 3.4.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild

* Fri Jul 11 2025 Shlomi Fish <[email protected]> 3.4.0-2
- Remove unused / unavailable deps ( eg - python3-random2 )
- Use pyprojectize/etc. to modernize the .spec
- rhbz#2379434
- rhbz#2377406

lyokha avatar Oct 31 '25 10:10 lyokha

This patch works for me:

--- /usr/lib/python3.14/site-packages/pysollib/ui/tktile/tkcanvas.py	2025-11-02 13:38:20.376228704 +0400
+++ tkcanvas.py.new	2025-11-02 13:38:10.889224321 +0400
@@ -199,10 +199,10 @@
     def _geometry(self):
         w = self.winfo_width()
         if w == 1:
-            w = int(self.cget('width'))
+            w = int(self.winfo_fpixels(self.cget('width')))
         h = self.winfo_height()
         if h == 1:
-            h = int(self.cget('height'))
+            h = int(self.winfo_fpixels(self.cget('height')))
         scrollregion = self.cget('scrollregion')
         if not scrollregion:
             return w, h

Apparently, the widths 10c was given in centimetres, but I don't know where to find the source of this settings and why it worked fine before.

lyokha avatar Nov 02 '25 09:11 lyokha

I'll need to review a bit more on my side to understand what's going on before I apply that fix - I have not been able to reproduce the issue in any of my environments, and this doesn't seem like something Fedora-specific. The "10c" value is not coming from the options.cfg file, right?

joeraz avatar Nov 06 '25 03:11 joeraz

No, there is no such value in my ~/.PySolFC/options.cfg.

I found this in https://tkinter-docs.readthedocs.io/en/latest/widgets/canvas.html:

width= Specifies a desired width that the canvas widget should request from its geometry manager. The value may be in any of the forms described in the coordinates section below. The default value is “10c”.

I.e. 10c is default width of a canvas. Btw, default value of height is 0.

I also tried to debug MfxCanvas constructor in pysollib/ui/tktile/tkcanvas.py. Adding line

        print(self.cget('width'))

after

        tkinter.Canvas.__init__(self, *args, **kw)

prints in stdout 10c when I run pysol from command-line. Also, when I change __init__ arguments to

        tkinter.Canvas.__init__(self, *args, **kw, width=100, height=100)

everything gets ok without the winfo_fpixels() application. It looks like kw argument in the previous Fedora release was richer while the newer lacks width and height values. Another debug line

        print(kw.get('width'))

prints None.

@joeraz you can try this sort of debug. Interesting, what will it print?

lyokha avatar Nov 06 '25 10:11 lyokha

I get a value of 378 with the first, and None with the second debug line.

joeraz avatar Nov 30 '25 16:11 joeraz

Also, forgot to mention that I did try the patch and it doesn't seem to break anything for me. I'll be testing a bit more to make sure, then if there's no issues, I'll commit that to close this issue.

joeraz avatar Nov 30 '25 16:11 joeraz

I have the same issue in Fedora 43. When I upgraded Fedora it warned that Python 3.07 random was incompatible with Fedora 43 and would be removed. I assumed that issue could be resolved later. I solved the problem by installing the Flatpak version with Gnome Software, and removing the Fedora version with dnf. It might have worked if I had just removed and reinstalled with dnf. Note: be sure you get the capitalization of the package right - PySolFC.

biomedr avatar Dec 04 '25 08:12 biomedr