Subject: python3.12 removed configparser.SafeConfigParser breaking python-x2go (inifiles.py)

From: Chris King <[email-masked]>
Date: Mon, 22 Jul 2024 13:33:53 +0930

Package: python-x2go

Version: 0.6.1.4

pyhoca-cli --session-profile frank11
/usr/bin/pyhoca-cli:560: SyntaxWarning: invalid escape sequence '\.'
  elif not re.match("^.*:[0-9]+(|\.[0-9]+)$", os.environ.get('DISPLAY')):
pyhoca-cli[18486] WARN: in case of a authentication failure, pyhoca-cli 
will interactively ask for a password.
pyhoca-cli[18486] NOTICE: preparing requested X2Go session
pyhoca-cli[18486] (PyHocaCLI) NOTICE: preparing requested X2Go session
Traceback (most recent call last):
  File "/usr/bin/pyhoca-cli", line 569, in <module>
    thisPyHocaCLI = PyHocaCLI(args, logger=logger, liblogger=liblogger)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pyhoca/cli/frontend.py", line 
379, in __init__
    x2go.X2GoClient.__init__(self, broker_url=self.args.broker_url, 
broker_password=self.args.broker_password, logger=liblogger, **_
backend_kwargs)
  File "/usr/lib/python3/dist-packages/x2go/client.py", line 316, in 
__init__
    self.session_profiles = 
self.profiles_backend(config_files=[_sessions_config_file], 
logger=self.logger, broker_url=broker_url, b
roker_password=broker_password, broker_noauth=broker_noauth)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/x2go/backends/profiles/file.py", 
line 60, in __init__
    inifiles.X2GoIniFile.__init__(self, config_files=config_files, 
logger=logger, loglevel=loglevel)
  File "/usr/lib/python3/dist-packages/x2go/inifiles.py", line 102, in 
__init__
    self.iniConfig = configparser.SafeConfigParser()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'configparser' has no attribute 
'SafeConfigParser'. Did you mean: 'RawConfigParser'?

SafeConfigParser has been an alias of ConfigParser since very early 
version of python3

Warnings were emitted in python3.11

python3.12 removed it entirely

I don't understand if the comment in inifiles.py makes just renaming the 
class a more complex solution.

My platform... not that I think it particularly impacts this bug, or its 
fix...

kubuntu-24.04 pyhoca-cli/0.6.1.3  python3/3.12.3  
remmina-plugin-x2go/1.4.35 remmina/1.4.35  x2goclient/4.1.2.3

This blocks the ability to connect to a remote x2goserver

I haven't reported this bug elsewhere.

All hail to wonderful package maintainers.

Chris.