WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: fix for crash in pygame.display.set_mode()  (Read 3228 times)

Offline tim33

  • Newbie
  • *
  • Posts: 2
fix for crash in pygame.display.set_mode()
« on: January 08, 2022, 05:34:20 AM »
steps to reproduce (on an old thinkpad x220; also reproduces with the x86_64 release):
 1. download & install http://tinycorelinux.net/12.x/x86/release/CorePlus-current.iso
 2. tce-load -wi python3.9
 3. python3 -m ensurepip
 4. pip3 install pygame
 5. python3 -c "import pygame; pygame.init(); pygame.display.init(); pygame.display.set_mode()"
 6. => crash in X11_Xinput2UngrabTouch (SDL_x11input2.c:385) that looks like a call to a NULL pointer

fix:
 1. tce-load -wi libXi # install missing python/pygame/SDL dependency

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Re: fix for crash in pygame.display.set_mode()
« Reply #1 on: January 08, 2022, 10:27:54 AM »
Hi tim33
Welcome to the forum.

I just ran  ldd  on both SDL and SDL2 from the TC12 x86 repository and neither showed a dependency on libXi.
Is it possible the the dependency came from  pygame ?

Offline tim33

  • Newbie
  • *
  • Posts: 2
Re: fix for crash in pygame.display.set_mode()
« Reply #2 on: January 08, 2022, 01:19:47 PM »
indeed, libXi is *not* declared as a dependency. however, unless it's installed, SDL's X11_Xinput2UngrabTouch() function crashes when pygame.display.init() calls it (at least on my thinkpad; haven't tested it on other computers).

so it feels that libXi should be part of the python3.9.tcz.tree. or something, i'm not exactly sure, sorry :)

ETA: checked all libraries under /usr/local/lib/python3.9/ (including pygame) with ldd -- did not find libXi dependency there either. so it seems a more nuanced problem than simply a missing dependency..
« Last Edit: January 08, 2022, 01:31:02 PM by tim33 »

Offline Oliviyamaya

  • Newbie
  • *
  • Posts: 2
    • https://www.ascendviral.com/dominate/ig/7633
Re: fix for crash in pygame.display.set_mode()
« Reply #3 on: May 01, 2022, 08:50:00 AM »
I've had this error happen a few times. It was caused by a call to set_mode on a display that was already set to another mode. Follow these steps to fix it: 1) Close all programs that are using Python and Pygame. 2) Bring up a command prompt (Start -> Run -> cmd or Windows key + R -> cmd). 3) cd to the folder with your Python file. 4) Run one of the following commands for whichever mode you are trying to change to: >pygame.display.set_mode((800,600)) >pygame.display.set_mode(800,600) >pygame.display.set_mode(800 600) In my case it was 800x600, but in step 3 I had to type out the mode name. 5) Open the .py file, and run it through Python. It should run fine, and there should be no error related to setting the display mode.
Transfer ownership of up right to save half and gain a benefit over the opposition.