Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

savefig() with StringIO.StringIO() object failing for PS backend on Python 2.7.5 #2498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

megies
Copy link
Contributor

@megies megies commented Oct 6, 2013

savefig(..., format="ps") is raising when passing on a StringIO.StringIO object.
This PR adds a minimal test case to demonstrate the issue. The issue was caused by the change in f4adec7b#diff-b465967f537465fec4960b152fa49cffL1110 (Py3 compatibility concerned, only present in master).

Here is the exception (I have checked, raw_fh is of type StringIO.StringIO):

  File "matplotlib/lib/matplotlib/backends/backend_ps.py", line 1108, in print_figure_impl
    fh = io.TextIOWrapper(raw_fh, encoding="ascii")
AttributeError: readable

A simple fix would be to revert those 4 lines, I guess, but I assume this might get handled differently, so I am not adding a fix for now.

@pelson
Copy link
Member

pelson commented Oct 11, 2013

Thanks @megies. Would you believe that this is the first PostScript test...? I'm astounded!
You need to add this test to the matplotlib/__init__.py file for it to get picked up (ironically, so that we can make the tests fail).

Thanks for adding the test, I think a bit of TDD is always welcome in mpl 😉

@megies
Copy link
Contributor Author

megies commented Oct 11, 2013

Well, it's understandable. Sometimes it's just simply higher priority to get something done. And writing (useful) tests can take so much more time than the actual implementing things..

@mdboom
Copy link
Member

mdboom commented Oct 11, 2013

Thanks for this report. It's revealed a number of issues.

I tried to create a PR against this one, but github wouldn't let me create one against @megies fork. So I just made #2512, and we can close this one.

@mdboom mdboom closed this Oct 11, 2013
@megies
Copy link
Contributor Author

megies commented Oct 11, 2013

Ok, thanks @mdboom. That's one point where it gets tricky with git, when opening PRs from a fork and main repo developers want to/have to jump in. I'll add you as collaborator, who knows, maybe it comes in handy at some point (can't hurt anyway).

@megies megies deleted the ps_StringIO branch October 11, 2013 14:50
@tacaswell
Copy link
Member

Odd, I have had a PR opened against my fork (tacaswell#1)

@mdboom
Copy link
Member

mdboom commented Oct 11, 2013

Does anyone see megies listed when they try to create a PR? It wasn't listed in the dropdown... maybe we have too many forks?

@tacaswell
Copy link
Member

If I go to https://github.com/megies/matplotlib I can push the PR button and get a comparison, but I don't see megies from the compare and review button on my fork.

@megies
Copy link
Contributor Author

megies commented Oct 11, 2013

Strange indeed, your fork is also not in my list.. maybe github should now about this.

screenshot_from_2013-10-11_18 21 17

@tacaswell
Copy link
Member

I agree with @megies, this smells like a github bug.

I set support a note.

@tacaswell
Copy link
Member

Got this back from support@github.com

Hey Thomas

Sorry for the trouble. This is a problem that we run into with very large fork networks, like the matplotlib one you're working with. We're aware of the issue and are discussing ways to improve this in the future. For the time being, manually editing the URL is the best way to get the comparison and Pull Request that you're looking for.

Let me know if you have any other questions.

Brian
GitHub Support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.