Package: pyracerz
Version: 0.2+dfsg-3
Severity: important
Tags: patch upstream
X-Debbugs-Cc: sma...@sdf.org

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
    I started the game and made menu selections up to the point when
    the race should start.
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
    1. I started pyracerz from the command line and the opening screen
       came up with a race car sound. The xterm I start it from showed
       these messages:

    12% pyracerz
    pygame 2.6.1 (SDL 2.30.11, Python 3.13.1)
    Hello from the pygame community. https://www.pygame.org/contribute.html
    Cannot use psyCo...
    
    2. From the opening menu I pressed enter with "Single Race" selected.
    3. The screen changed to one with header "singleRace: chooseTrack.
       I pressed enter with the default < bio > track selected.
    4. Next came the screen with header "singleRace: chooseNbLaps" I
       pressed enter with 1 selected.
    5. Next it was "singleRace: chooseNbHumanPlayers". I down arrowed
       to 1 and pressed enter.
    6. Next "singleRace: chooseHumanPlayer1". I pressed up error to
       select GO and pressed enter, which accepted the default settings.
    7. Next "singleRace: chooseNbRobotPlayers". I pressed enter with 0
       selected.
    8. The graphical window closed, the program terminated, and the
       xterm I started it from showed these two new messages:
       
       Cannot load track : 
       'ConfigParser' object has no attribute 'readfp'
       
   * What was the outcome of this action?
   The game couldn't be played. Only the options could selected. 
   The error messages above appeared on my xterm.
   * What outcome did you expect instead?
   For the race to start.

   It looks like python 3.2 removed readfp from the ConfigParser class
   and replaced it with read_file. You can see
   "New in version 3.2: Replaces readfp()" under the read_file entry
   here in Python 3.2 documentation:
   https://docs.python.org/3.2/library/configparser.html#configparser-objects
   Contrast that with Python 3.1 documentation that still has readfp
   (under the RawConfigParser base class):
   https://docs.python.org/3.1/library/configparser.html#rawconfigparser-objects

   When I patched and built the source package locally with readfp
   renamed to read_file I could get to the track screen and play the
   game. I'm attaching the patch replace-readfp.patch which should
   apply cleanly after the other patches have applied (i.e. after
   font-replacement.patch).

*** End of the template - remove these template lines ***


-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.8-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages pyracerz depends on:
ii  fonts-radisnoir  0.9b-5
ii  python3          3.13.1-2
ii  python3-pygame   2.6.1-1

pyracerz recommends no packages.

pyracerz suggests no packages.

-- no debconf information

Index: b/modules/menu.py
===================================================================
--- a/modules/menu.py
+++ b/modules/menu.py
@@ -1071,7 +1071,7 @@ class MenuHiscores(Menu):
     
     confFile=configparser.ConfigParser() 
     try:
-      confFile.readfp(open("/var/games/pyracerz/pyracerz.conf", "r")) 
+      confFile.read_file(open("/var/games/pyracerz/pyracerz.conf", "r")) 
       self.nbItem = 0
 
       for sect in confFile.sections():
@@ -1117,7 +1117,7 @@ class MenuHiscores(Menu):
 
     confFile=configparser.ConfigParser() 
     try:
-      confFile.readfp(open("/var/games/pyracerz/pyracerz.conf", "r")) 
+      confFile.read_file(open("/var/games/pyracerz/pyracerz.conf", "r")) 
     except Exception:
       return
 
Index: b/modules/misc.py
===================================================================
--- a/modules/misc.py
+++ b/modules/misc.py
@@ -160,7 +160,7 @@ def addHiScore(track, player):
 
   confFile=configparser.ConfigParser() 
   try:
-    confFile.readfp(open("/var/games/pyracerz/pyracerz.conf", "r")) 
+    confFile.read_file(open("/var/games/pyracerz/pyracerz.conf", "r")) 
   except Exception:
     fileExist = 0
   
@@ -169,7 +169,7 @@ def addHiScore(track, player):
     fwrite = open("/var/games/pyracerz/pyracerz.conf", "w+")
     confFile.add_section("hi " + track.name)
     confFile.write(fwrite)
-    confFile.readfp(open("/var/games/pyracerz/pyracerz.conf", "r")) 
+    confFile.read_file(open("/var/games/pyracerz/pyracerz.conf", "r")) 
 
   # For the Inverse
   if track.reverse == 0:
@@ -220,7 +220,7 @@ def getUnlockLevel():
 
   confFile=configparser.ConfigParser() 
   try:
-    confFile.readfp(open("/var/games/pyracerz/pyracerz.conf", "r")) 
+    confFile.read_file(open("/var/games/pyracerz/pyracerz.conf", "r")) 
   except Exception:
     return 0
 
@@ -247,7 +247,7 @@ def setUnlockLevel(lck):
 
   confFile=configparser.ConfigParser() 
   try:
-    confFile.readfp(open("/var/games/pyracerz/pyracerz.conf", "r")) 
+    confFile.read_file(open("/var/games/pyracerz/pyracerz.conf", "r")) 
   except Exception:
     fileExist = 0
 
@@ -255,7 +255,7 @@ def setUnlockLevel(lck):
     fwrite = open("/var/games/pyracerz/pyracerz.conf", "w+")
     confFile.add_section("unlockLevel")
     confFile.write(fwrite)
-    confFile.readfp(open("/var/games/pyracerz/pyracerz.conf", "r"))
+    confFile.read_file(open("/var/games/pyracerz/pyracerz.conf", "r"))
 
   h = hashlib.sha1(b"pyRacerz")
   h.update(str(lck).encode())
Index: b/modules/track.py
===================================================================
--- a/modules/track.py
+++ b/modules/track.py
@@ -48,7 +48,7 @@ class Track:
     self.track = pygame.transform.scale(getImageFromTrackName(name), (int(1024*misc.zoom), int(768*misc.zoom)))
     self.trackF = pygame.transform.scale(getImageFFromTrackName(name), (int(1024*misc.zoom), int(768*misc.zoom)))
     confFile=configparser.ConfigParser()
-    confFile.readfp(open(os.path.join("/usr/share/games/pyracerz/tracks", name + ".conf"), "r"))
+    confFile.read_file(open(os.path.join("/usr/share/games/pyracerz/tracks", name + ".conf"), "r"))
 
     self.name = name
     self.author = confFile.get("track", "author")

Reply via email to