【发布时间】:2016-03-03 08:43:34
【问题描述】:
错误:
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
可能的提示 A:我现在在 Ubuntu 上。在 Windows 上运行相同的脚本时我没有遇到这个问题。
可能的提示 B: 第一次调用 pygame.image.save 时,libpng 会产生以下警告:
libpng 警告:使用 libpng-1.2.51 构建但使用 1.6.17 运行的应用程序
我应该怎么做才能解决这个问题?
我尝试过的一些事情:
1) 我可以加载 PNG 吗? 可以
2) 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)
这些测试的结果让我认为该问题不太可能是由于将我的代码从 Windows 移植到 Ubuntu 所特有的问题(例如,我已尝试尽可能修复路径名等,并且pygame 测试应该独立于平台,但仍然失败?)。
【问题讨论】:
标签: python ubuntu pygame libpng