Skip to content
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

To workaround dvipgn call #24304

Open
denis-x opened this issue Nov 24, 2022 · 5 comments · May be fixed by #26469
Open

To workaround dvipgn call #24304

denis-x opened this issue Nov 24, 2022 · 5 comments · May be fixed by #26469
Labels

Comments

@denis-x
Copy link

denis-x commented Nov 24, 2022

Hello,

recently I have discovered issue with printing/preview.py on Windows machine, that dvipng subprocess call is just infinite stuck (no time-out, when it is called). I was able to workaround it by adding "--nogs" option.

Could you, please, consider to add the same and also bound subprocess calls within some time-out.

BR

@oscarbenjamin
Copy link
Contributor

Could you, please, consider to add the same and also bound subprocess calls within some time-out.

Sounds fine to me. Feel free to open a PR.

Can you give an example of an expression that demonstrates this?

@denis-x
Copy link
Author

denis-x commented Nov 24, 2022

I am not much familiar with PR process, so opened ticket.

Unfortunately or fortunately, there is no example, which I can provide.
This is outcome of my investigation, why LCAPY import stuck any output of Jupyter on my system, which was not reproduced by author.

@oscarbenjamin
Copy link
Contributor

As far as I know preview usually works on Windows. It's a bit difficult for someone else to write and test a PR if there is no way to reproduce the problem.

You can use the outputTexFile argument to preview to have the tex file copied somewhere before latex etc are called.

@denis-x
Copy link
Author

denis-x commented Nov 24, 2022

Can you try below code?
from io import BytesIO
obj = BytesIO()
preview('x + y', output='png', viewer='BytesIO', outputbuffer=obj)

@oscarbenjamin
Copy link
Contributor

That code runs fine here on OSX:

In [10]: from io import BytesIO
    ...: obj = BytesIO()
    ...: preview('x + y', output='png', viewer='BytesIO', outputbuffer=obj)

In [11]: obj.seek(0)
Out[11]: 0

In [12]: obj.read()
Out[12]: b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00)\x00\x00\x00\x0e\x08\x02\x00\x00\x00=\xab\xa2/\x00\x00\x00\tpHYs\x00\x00\x0e\xc4\x00\x00\x0e\xc4\x01\x95+\x0e\x1b\x00\x00\x01>IDAT8\xcb\xc5U\xd1\x8d\x84 \x10\x1d\xae\x02\xb0\x04,AK\xc0\x0e\xb4\x05\xb4\x02\xb5\x04\xed\x00[\x90\x0etK@;\xa0\x05,a\xee\x03\xc3\x99M\xee\xce\x8dnv\xbe\x98\xc7\xc0c\x1e/@\x10\x11>\x14_W\x16\x97e\xf91\xee\xab}\x0f\xc3\x10\xc71!Dk\xed[!\x84\x14E\xb1m\xdb-\x04O\xfb/\xcb\xc2\x18K\x92\xc4Z\x0b\x88\x88\x88\x94\xd2i\x9a\x10Q)e\x8c\xc1s!\xa5<S6M\x13\xa54\xa4]\xd7\xf9\xc1\xae\xf98\x8eUUYk\xa3(J\x92\xe4^m\xb3,\x8b\xa2h\x9eg\x9fr\xce\xfd\x80\x04\x9f\x97ei\x8cY\x96\xe5\x8f]\x8a\xa28\xa6\x8f\xc7C\x08\x11R!\xc4o\xee\xeb\xfb\xde\x18\xa3\xb5\xd6Z\x0b!\x18c\x00\x00A\n\xa5\x14\xe7\xdc+\x7f\xaf\xe6\x88\xe8\x9c\x03\x00\xe7\x9cR*\x80\xbb\xe6\xd6Z\xce\xb9R\xaa\xaa\xaawX\x9a1&\x84h\xdb6M\xd3\x1f\xd4\x1f*t \xa5<\xdf\xcd\xf9J\xef8\xce\xf9\x11\x81\xae\xeb(\xa5\x01\xcd\xf3\x1c\x00\xf2<?\xe3\xf6\x97\xb8\x8f\x0e\xdf\xb9\xf1B\xbc\xc4=\x8e\xa3s\xee\x88\\z\xd7\xea\xba\xfe\xb7\xa6i\x9aa\x18\xc2\xad\x1f\xa7\xc8\xbb\xff\x92y\x9e\xd7u\x05\x00)\xe5\x13\xf77\\u~\xa7y\x16\x89\x8a\x00\x00\x00\x00IEND\xaeB`\x82'

Writing those bytes to tmp.png gives this image:
tmp

denis-x pushed a commit to denis-x/sympy that referenced this issue Dec 6, 2022
Add "-nogs" option for dvipng call
Add 10s timeout for subprocess calls
denis-x pushed a commit to denis-x/sympy that referenced this issue Dec 6, 2022
Add "-nogs" option for dvipng call
denis-x pushed a commit to denis-x/sympy that referenced this issue Jan 20, 2023
Add "-nogs" option for dvipng call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants