473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Connecting to gnuplot with Popen?

Hi,

it seems to be a FAQ, but I still haven't found a solution. I want to
control gnuplot with a python program. The following at least gives me the
gnuplot output:

subp=Popen("gnuplot",stdin=None,stderr=PIPE,stdout =PIPE)
....
subp.stderr.readline()

even though I'm not sure how to check if no more lines can be read with
readline() so that it doesn't block.
But after the script has finished, the console doesn't show me the
characters I type.

However, as soon as I try:

subp=Popen("gnuplot",stdin=PIPE,stderr=PIPE,stdout =PIPE)
....
subp.stderr.readline()

the program hangs.

What's wrong?

Anton
Mar 30 '06 #1
5 4900
On Thu, 30 Mar 2006 12:59:01 +0200,
Anton81 <fo***@anton.e4ward.com> wrote:
it seems to be a FAQ, but I still haven't found a solution. I want to
control gnuplot with a python program ...


Unfortunately, I don't know how to solve your problem, but try this:

http://gnuplot-py.sourceforge.net/

Regards,
Dan

--
Dan Sommers
<http://www.tombstonezero.net/dan/>
"I wish people would die in alphabetical order." -- My wife, the genealogist
Mar 30 '06 #2
> I want to control gnuplot with a python program.

Hi Anton,

here is a little snippet using os.popen:
import os

gp = os.popen('gnuplot -persist', 'w')
print >> gp, "set yrange [-300:300]"
for n in range(300):
print >> gp, "plot %i*cos(x)+%i*log(x+10)" % (n,150-n)
Regards, mawe

Mar 31 '06 #3
> Hi Anton,

here is a little snippet using os.popen:


Unfortunately I'm having more problem getting the output from Gnuplot, which
I'd like to examine for error messages and settings of options.

Anton
Mar 31 '06 #4
Anton81 a écrit :
Hi,

it seems to be a FAQ, but I still haven't found a solution. I want to
control gnuplot with a python program. The following at least gives me the
gnuplot output:


Unless you absolutely need to write your own code, you should try:
http://gnuplot-py.sourceforge.net/

A+

Laurent.
Mar 31 '06 #5
Anton81 <fo***@anton.e4ward.com> writes:
Hi Anton,

here is a little snippet using os.popen:


Unfortunately I'm having more problem getting the output from Gnuplot, which
I'd like to examine for error messages and settings of options.


If you must roll your own, look at standard module subprocess.
John

Apr 1 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rama Calaga | last post by:
Hi, I use both python and gnuplot a lot, but I am unable to find a way to embed gnuplot "window/canvas" into tkinter. BLT option in PMW is not so powerful and not so great, any suggestions ?? ...
0
by: Cedric | last post by:
This is a 3 weeks old problem, but having found a solution (and having looked for one here, finding only this message), I'm replying now. From: Jive (someone@microsoft.com) Subject: Upgrade...
9
by: syd | last post by:
I don't even know where to begin. This is just bizarre. I just picked up the Gnuplot.py module (a light interface to gnuplot commands) and was messing around with it today. I've got a tiny...
6
by: Joseph Suprenant | last post by:
Hello all, I have a C++ program, it does some calculations on things and then prints out a file in the format in which GNUPLOT can use. So my question is how would i call GNUPLOT from my C++...
1
by: Nicola Kaiser | last post by:
Hi, I´m using Gnuplot via gnuplot.py and I´m looking for a way to get the plotting output (terminal set to png in my case) piped in a string instead of to stdout or a file. Is there any...
0
by: bwaha | last post by:
I've posted this question to comp.graphics.apps.gnuplot too but given that this python group may also comprise a lot of gnuplot users, and is far more active, I've posted this question here too. My...
3
by: Peter Beattie | last post by:
I am trying to plot something in gnuplot 4.2 using co-ordinates a Python 2.5 program computes. Here's what I'm doing: pyfrom subprocess import * pyplot = Popen("c:/progs/gp/bin/wgnuplot.exe",...
1
by: mkxc | last post by:
hi, i'm new here and would like to know how to use gnuplot. I have an assignment which require me to read and convert a .txt file into an array. The txt file contains numbers/integers/floats. I'm...
2
by: Blah | last post by:
I'm trying to use the system() in a C++ program to execute gnuplot on a file of data on OSX and have the graph pop up but so far the only thing I've managed to do is get gnuplot to open. as I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.