[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] `pygame`: on Ubuntu, using `pygame.image.save` to save PNG causes `pygame.error: SavePNG: could not create png write struct`



Hi,

On 15-11-29 12:25 PM, rockachu2@xxxxxxxxx wrote:
A possible solution is to compile pygame yourself on that machine.
See the website for details, but its not very involved on ubuntu.


I do most of my Pygame development on Ubuntu 14.04 (Linux Mint 17.1). Of course I build it myself, and have it passing all the tests. You will need the following development packages installed: libpython2.7-dev (or libpython3.4-dev), libsdl1.2-dev, libsdl-ttf2.0-dev, libsdl-image1.2-dev, libsdl-mixer1.2-dev, libfreetype6-dev, libpng12-dev, libjpeg8-dev, libportmidi-dev, and libX11-dev (for the scrap module).

Building and installing is as simple as downloading the source, then in the source directory doing

python config.py
python setup.py install --prefix=where-you-want-it-to-go

If you want the docs, you will also need to install the python-sphinx package and run

python makeref.py

before the "python setup.py ..."



On Nov 29, 2015, at 11:38, Brian Merchant <bhmerchant@xxxxxxxxx <mailto:bhmerchant@xxxxxxxxx>> wrote:

Hi all,

I am now on Ubuntu. I did not have this issue when running the same script on Windows.

Here's the error I am getting:

File "/home/alien/cncell/core/animator.py", line 413, in create_animation_from_data
        pygame.image.save(screen, image_fp)
    pygame.error: SavePNG: could not create png write struct


When `pygame.image.save` is first called, `libpng` produces the following warning:

> libpng warning: Application built with libpng-1.2.51 but running with 1.6.17


Some things I have tried:

1) can I load PNGs? yes

2) results of `python -m pygame.tests`:

======================================================================
    FAIL: BaseModuleTest.test_get_error
----------------------------------------------------------------------
    Traceback (most recent call last):
File "/home/brian/anaconda2/lib/python2.7/site-packages/pygame/tests/base_test.py", line 569, in test_get_error
        e)
AssertionError: Failed to access the SoundFont /usr/share/sounds/sf2/FluidR3_GM.sf2


This is the installed SDL_mixer library complaining about missing FluidSynth sound patch files. It can be ignored.

======================================================================
    FAIL: BaseModuleTest.test_set_error
----------------------------------------------------------------------
    Traceback (most recent call last):
File "/home/brian/anaconda2/lib/python2.7/site-packages/pygame/tests/base_test.py", line 586, in test_set_error
        e)
AssertionError: Failed to access the SoundFont /usr/share/sounds/sf2/FluidR3_GM.sf2
======================================================================
    ERROR: GL_ImageSave.test_image_save_works_with_opengl_surfaces
----------------------------------------------------------------------
    Traceback (most recent call last):
File "/home/brian/anaconda2/lib/python2.7/site-packages/pygame/tests/image__save_gl_surface_test.py", line 37, in test_image_save_works_with_opengl_surfaces
pygame.image.save(screen, tmp_file)
    error: SavePNG: could not create png write struct
======================================================================
    ERROR: ImageModuleTest.testSavePNG24
----------------------------------------------------------------------
    Traceback (most recent call last):
File "/home/brian/anaconda2/lib/python2.7/site-packages/pygame/tests/image_test.py", line 215, in testSavePNG24
pygame.image.save(surf, f_path)
    error: SavePNG: could not create png write struct
======================================================================
    ERROR: ImageModuleTest.testSavePNG32
----------------------------------------------------------------------
    Traceback (most recent call last):
File "/home/brian/anaconda2/lib/python2.7/site-packages/pygame/tests/image_test.py", line 184, in testSavePNG32
pygame.image.save(surf, f_path)
    error: SavePNG: could not create png write struct
======================================================================
    ERROR: ImageModuleTest.test_save
----------------------------------------------------------------------
    Traceback (most recent call last):
File "/home/brian/anaconda2/lib/python2.7/site-packages/pygame/tests/image_test.py", line 248, in test_save
pygame.image.save(s, temp_filename)
    error: SavePNG: could not create png write struct
======================================================================
    ERROR: ImageModuleTest.test_save_colorkey
----------------------------------------------------------------------
    Traceback (most recent call last):
File "/home/brian/anaconda2/lib/python2.7/site-packages/pygame/tests/image_test.py", line 275, in test_save_colorkey
pygame.image.save(s, temp_filename)
    error: SavePNG: could not create png write struct
======================================================================
    ERROR: ImageextModuleTest.test_save_unicode_path
----------------------------------------------------------------------
    Traceback (most recent call last):
File "/home/brian/anaconda2/lib/python2.7/site-packages/pygame/tests/imageext_test.py", line 65, in test_save_unicode_path
imageext.save_extended(im, temp_file)
    error: SavePNG: could not create png write struct
----------------------------------------------------------------------
    Ran 708 tests in 28.894s
    FAILED (failures=2, errors=6)

The results of these tests makes me think that the issue is unlikely to be due to issues specific to the porting of my code from Windows to Ubuntu (so for instance, I have tried to fix pathnames, etc. wherever possible, and the `pygame` tests should be platform independent, but still fail?).

What should I do to fix this issue?

Kind regards,
Brian



Hope this is of some help,

Lenard Lindstrom