Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
illume opened this issue Aug 22, 2011 · 0 comments
Closed
Labels
bug image pygame.image

Comments

@illume
Copy link
Member

illume commented Aug 22, 2011

Originally reported by: René Dudfield (Bitbucket: illume, GitHub: illume)


== 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


@illume illume added trivial bug image pygame.image labels Mar 26, 2017
@illume illume closed this as completed Mar 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug image pygame.image
Projects
None yet
Development

No branches or pull requests

1 participant