PyGnuplot icon indicating copy to clipboard operation
PyGnuplot copied to clipboard

The read function uses the wrong queue

Open AndreaManghi opened this issue 1 year ago • 2 comments

Hello, I'm using this library for a work project that needs to run on Linux and Windows with Gnuplot 5.4.8 I'm currently trying to produce an SVG from a gnuplot script generated with jinja, but I immediately noted that I was getting no response from gnuplot, "r" and "a" functions always returned an empty list. First I tested the script obtained from jinja, using it directly from command line, and it worked. So i digged a bit and I figured out that gnuplot was outputting on stdout, instead PyGnuplot was reading stderr. I fixed the code by changing line 89 in PyGnuplot.py from:

line = self.q_err.get(timeout=timeout)

to:

line = self.q_out.get(timeout=timeout) 

It works for me, both on linux and windows, but i don't know if it works on every platform this library supports, and since it was made differently I'd like to ask more about this issue and if my fix could be a valid solution.

AndreaManghi avatar Jul 06 '23 06:07 AndreaManghi

After some tests I understood why the default queue was q_err, however some terminals like svg output on stdout. At the moment I modified the function and added a new argument to choose the queue to read from, but it could be interesting to find a way to make this automatically.

AndreaManghi avatar Jul 11 '23 08:07 AndreaManghi

Dear Andrea, thanks for the message, will look into it soon.

benschneider avatar Jul 12 '23 05:07 benschneider