pysolfc no longer works in 22.04 due to python changes

Bug #1967793 reported by Dave Stroud
34
This bug affects 7 people
Affects Status Importance Assigned to Milestone
pysolfc (Debian)
New
Unknown
pysolfc (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

have tried all suggestion that I can find on line nothing works.Is their a work around that anyone has found.

Revision history for this message
Manfred Hampl (m-hampl) wrote :
Revision history for this message
Chuck Pool (karmajun) wrote :

I too am at a loss for repairing or mitigating Ubuntu 22.04 Beta's python3.10 'deprecated formatter.py' and its status as 'obsolete, little used, and untested' in a bug-ticket found from Aug of 2021. My Pysolfc will not start on Ubuntu Beta 22.04 and it is annoying to say the least. I am not facile at coding and although I can compile programs with minor difficulty and easily follow directions with BASH, every 'fix' I've read leaves me with pysolfc in some kind of 'stutter-stop' loop.
If there are any directions for exploring the hang-ups in Beta 22.04 Ubuntu, I'd really appreciate them as I've exhausted my abilities.
Thanks
Oh I tried to document my issues using Terminal output:

:~$ Uname -a

Linux doc-Lat-E7470 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

:!$ lsb_release -crid

Distributor ID: Ubuntu
Description: Ubuntu Jammy Jellyfish (development branch)
Release: 22.04
Codename: jammy

:~$ apt policy pysolfc

pysolfc:
  Installed: 2.6.4-3
  Candidate: 2.6.4-3
  Version table:
 *** 2.6.4-3 500
        500 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu jammy/universe i386 Packages
        100 /var/lib/dpkg/status

:~$ /usr/games/pysolfc

Traceback (most recent call last):
  File "/usr/games/pysolfc", line 36, in <module>
    from pysollib.main import main # noqa: E402,I202
  File "/usr/share/games/pysolfc/pysollib/main.py", line 30, in <module>
    from pysollib.app import Application
  File "/usr/share/games/pysolfc/pysollib/app.py", line 32, in <module>
    from pysollib.images import Images, SubsampledImages
  File "/usr/share/games/pysolfc/pysollib/images.py", line 28, in <module>
    from pysollib.pysoltk import copyImage, createBottom, createImage, loadImage
  File "/usr/share/games/pysolfc/pysollib/pysoltk.py", line 35, in <module>
    from pysollib.tile.tkhtml import * # noqa: F401,F403
  File "/usr/share/games/pysolfc/pysollib/tile/tkhtml.py", line 29, in <module>
    from pysollib.ui.tktile.tkhtml import Base_HTMLViewer
  File "/usr/share/games/pysolfc/pysollib/ui/tktile/tkhtml.py", line 28, in <module>
    import pysollib.htmllib2 as htmllib
  File "/usr/share/games/pysolfc/pysollib/htmllib2.py", line 7, in <module>
    from formatter import AS_IS
ImportError: cannot import name 'AS_IS' from 'formatter' (/usr/lib/python3.10/formatter.py)

Thanks

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in pysolfc (Ubuntu):
status: New → Confirmed
Changed in pysolfc (Debian):
status: Unknown → New
Revision history for this message
Miguel Ángel García (magmax9) wrote :

Bug is documented in [pysolfc #217](https://bugs.launchpad.net/ubuntu/+source/pysolfc/+bug/1967793) and solved in pysolfc 2.14. Ubuntu 22.04 is installing pysolfc 2.6.

Revision history for this message
Dave Stroud (bigdavesr) wrote :

I found a way to run psfc.Install windows version with wine.Works perfect.

Revision history for this message
Joey Simon (kf4jrt) wrote (last edit ):

<SOLVED> formatter.py missing in Python3.10. Simply copy the formatter.py file from any other version into the Python3.10 folder.

I had the same problem with Pysolfc and Python3.10, but I have found the answer to the problem. In version of Python 3.10 they left out formatter.py. I am using a fork of Ubuntu (Linux Mint) so a few things may vary in location of the file. I installed Python3.8, so in /usr/lib/python3.8/ there was the file formatter.py. I copied the formatter.py into the usr/lib/python3.10/ where it was missing. Then tried to open Pysolfc and all is well. I hope this helps everyone else as much as it did me. I read that the creators of Python said that the file formatter.py wasn't used anymore and was outdated. I beg to differ as would the rest you.
Before this I tried changing the default python version from 3.10 to 3.8 with sudo update-alternatives --config python and choose version 3.8, but that didn't help. So, I changed the python version back to Python3.10.4
Have a great day!
Thanks Joey

Revision history for this message
Xmetal (xmetalfanx) wrote :

I found this after helping a Linux Mint user (Mint 21 based on Ubuntu 22.04) and this bug affects them as well as myself on Ubuntu Budgie 22.04 at the time of me trying this.

I think the easiest solution would be for the package maintainer for Ubuntu to update to the new version of pysolfc, rather than use any "hacky" solutions, as the developer seems to have fixed the issue and the package version in Ubuntu 22.04's repos is from 2019 I think, and there have been several updates since then

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

A possible fix would be to backport https://github.com/shlomif/PySolFC/commit/79d27d2749c906040073909a2a7c1162282b806c.

In the long run, ideally, we should move away from the formatter module, since it has been deprecated since python 3.5 and it is not well tested. Moreover, we should (ideally) update the package to a more recent version in Debian.

Due to the patch linked above, debian/copyright should also be updated to include the license for the new formatter port. Therefore, before considering the upstream patch (or updating the Debian package), we should verify if python's 3.9 module is compatible with CC0, as it was licensed by pysolfc upstream.

Looking at https://github.com/python/cpython/blob/3.9/Lib/formatter.py, I see no license headers. I then assume it is licensed under the Python Software Foundation License Version 2, as the rest of the code in that repository.

While I am not a lawyer, these 2 bits from the PSF license may concert pysolfc upstream regarding the embedded formatter file:

2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Python Software Foundation;
All Rights Reserved" are retained in Python alone or in any derivative version
prepared by Licensee.

3. In the event Licensee prepares a derivative work that is based on
or incorporates Python or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python.

Revision history for this message
Dave Stroud (bigdavesr) wrote :

There is now a new version in snap that works great

Revision history for this message
Chuck Pool (karmajun) wrote :

@bigdavesr:
Damn right it works!
I just found the snap version for ubuntu (still running 21.10 since pysolfc wouldn't work no matter what files I brought over from 21.10. on the one computer I did upgrade.
I thought I'd try it in 21.10 - and it works - just all my data files are not snap available. Which is fine, when I'm sitting online supposed to be listening to a Zoom or Google meet that is more than boring, my game of choice is pysol.
Py-sol-fc by Jintao Yang
Thanks for the heads up @bigdavesr, and thanks for the snap addition Jintao Yang!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.