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

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



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