econchick / new-coder

New Coder tutorials
zlib License
597 stars 394 forks source link

libpng error when running api.py #178

Open econchick opened 9 years ago

econchick commented 9 years ago

Reported from Twitter and also found on reddit, libpng throws an error when trying to run the API script in tutorial 2.

The following output is seen:

INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): www.giantbomb.com
/home/user/Projects/new-coder/apis/APIProj/lib/python2.7/site-packages/matplotlib/axis.py:1004: UserWarning: Unable to find pixel distance along axis for interval padding; assuming no interval padding needed.
  warnings.warn("Unable to find pixel distance along axis for interval padding; assuming no interval padding needed.")
/home/user/Projects/new-coder/apis/APIProj/lib/python2.7/site-packages/matplotlib/axis.py:1011: UserWarning: Unable to find pixel distance along axis for interval padding; assuming no interval padding needed.
  warnings.warn("Unable to find pixel distance along axis for interval padding; assuming no interval padding needed.")
libpng warning: Image width is zero in IHDR
libpng error: Invalid IHDR data

  Traceback (most recent call last):
    File "pricing_platform.py", line 389, in <module>
     main()
   File "pricing_platform.py", line 381, in main
     generate_plot(platforms, opts.plot_file)
   File "pricing_platform.py", line 282, in generate_plot
     plot.savefig(output_file, dpi=72)
   File "home/user/Projects/new-coder/apis/APIProj/lib/python2.7/site-packages/matplitlib/pyplot.py"
   line 561, in savefig
     return fig.savefig(*args, **kwargs)
   File "home/user/Projects/new-coder/apis/APIProj/lib/python2.7/site-packages/matplitlib/figure.py"
   line 1421, in savefig
     self.canvas.print_figure(*args, **kwargs)
   File "home/user/Projects/new-coder/apis/APIProj/lib/python2.7/site-packages/matplitlib/backend_bases.py", line 2220, in print_figure
   File "home/user/Projects/new-coder/apis/APIProj/lib/python2.7/site-packages/matplitlib/backends/backend_agg.py", line 517, in print_png
      filename_or_obj, self.figure.dpi)
RuntimeError: Error building image

I'm currently investigating versions of OS, libpng, and matplotlib. The reports seem to only be Python 2.7 but not sure if this affects other 2.x's. Reports seem to be from Mac OS X and Linux of some sort, but again - still investigating.

If you've come to this issue from outside and this is affecting you (and this issue is still open), please comment below with your operating system & version, Python version, libpng version, and matplotlib version.

catomania commented 8 years ago

I'm running into this issue as well. operating system & version: Mac OS X Yosemite, 10.10.5 Python version: 2.7.10 libpng version: libpng16.16 (I believe, had to search my entire Mac for "libpng" before finding a "RECORD" document on my Mac) matplotlib: 1.4.2

econchick commented 8 years ago

@catomania thanks so much! This helps a lot! (And thanks for the other issues - not a lot of time lately to get to them because of work but hopefully I'll address them soon!)