Issue #16 resolved

Pygame segfaults when attempting to save jpeg to folder that does not exist

illume
created an issue

== Devin Jeanpierre, 2008-05-26 00:11:47 -0700

{{{ The expected behavior for saving a file to a folder that doesn't exist is to raise a pygame.error . This does happen when I attempt to save in .tga format, however, with .jpg, it causes a segmentation fault. I can save .jpg files to folders that do exist. Here is what I ran in my interpreter to show this:


Python 2.5.1 (r251:54863, May 4 2007, 16:52:23) [GCC 4.1.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import pygame pygame.init() (6, 0) pygame.ver '1.8.0release' pygame.image.get_extended() 1 surf = pygame.Surface((100,100)) pygame.image.save(surf, 'surf.jpg') pygame.image.save(surf, 'this/folder/doesnt/exist/test.tga') Traceback (most recent call last): File "<stdin>", line 1, in <module> pygame.error: Couldn't open this/folder/doesnt/exist/test.tga pygame.image.save(surf, 'this/folder/doesnt/exist/test.jpg') Fatal Python error: (pygame parachute) Segmentation Fault Aborted


A suitable example script, then, would be:

!/usr/bin/env python

import pygame pygame.init() surf = pygame.Surface((100,100)) pygame.image.save(surf, 'this/folder/doesnt/exist/test.jpg') print "You made it!"


I left most of these admin-type values alone. I don't expect myself to be able to judge how bad the developers think this problem is, and I don't know what 'P5' or 'P4' is. Anyway, I hope I was as thorough as possible. }}}


== Devin Jeanpierre, 2008-05-26 00:13:36 -0700

{{{ Created attachment 11 Test case as shown in bug report }}}


Attachments: [[http://www.pygame.org/old_bug_attachments/11/pygametest.py| pygametest.py]]

== Thorbrian, 2008-05-26 12:23:02 -0700

{{{ fixed rev. 1248 - the crash was happening on any jpeg or png save error, actually, thanks for catching it }}}


Comments (0)

  1. Log in to comment