econchick / econchick/new-coder

libpng error when running api.py

Open
#178 2 comments 0 reactions 1 assignee Claimed by @econchick View on GitHub
bug investigate
Dominant language
CSS
Stars
591
Forks
378
PR merge metrics
No merged PRs in 30d

Description

Reported from [Twitter](https://twitter.com/syc22/status/599426964609458176) and also found on [reddit](https://www.reddit.com/r/learnpython/comments/2aqsqi/running_into_some_problems_with_api_tutorial/), `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
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.