473,287 Members | 1,904 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,287 software developers and data experts.

Add readline capability to existing interactive program

Hello,

I use an interactive simulator/data plotter called ocean. I get really
frustrated using it because it does not have basic readline
capabilities like ctrl-a for beginning of line and ctrl-k to kill the
rest of the line.

I was thinking this might be easy to add with Python. Do something
like start python and then kick off the ocean job and then use
something like pexpect to interact with it. I think this would work
but there may be an even easier way to do it, maybe directly with
popen2.

A quick google search lead me to:

http://aspn.activestate.com/ASPN/Coo.../Recipe/108287

and shows code:

import os
f=os.popen('gnuplot', 'w')
print >>f, "set yrange[-300:+300]"
for n in range(300):
print >>f, "plot %i*cos(x)+%i*log(x+10)" % (n,150-n)
f.flush()
this kind of works but not quite. Windows don't pop open and results
of calculations (3+3) don't echo back.

Before I started coding, I thought I would ask if a module or examples
already exits that do what I want.

jr

Mar 14 '07 #1
1 1171

Jacob Rael wrote:
Hello,

I use an interactive simulator/data plotter called ocean. I get really
frustrated using it because it does not have basic readline
capabilities like ctrl-a for beginning of line and ctrl-k to kill the
rest of the line.
I guess the easiest way would be this: http://freshmeat.net/projects/rlwrap/.
If you use Microsoft Windows, a cygwin version is available too,
apparently.
<snipped>
--
Kushal Kumaran

Mar 15 '07 #2

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

Similar topics

1
by: Jonathan Daugherty | last post by:
Hello all, I've read some posts here talking about the fact that the 'readline' module packaged with python is only good for augmenting the behavior of the interactive interpreter. Can anyone...
12
by: Mike Maxwell | last post by:
When I invoke readline() in a for loop, why does it return a series of one-char strings, rather than the full line? >>> for sL in sys.stdin.readline(): print sL .... abc a b c
0
by: Brano Zarnovican | last post by:
Hi ! I'd like to init curses and still have working Python interactive command line. I found that you can replace stdin/stdout/stderr like this: #!/usr/bin/python -i import curses import...
2
by: Grant Edwards | last post by:
I'm trying to figure out how to use the gnu readline library so that when my program is prompting the user for input there is line editing and history support. I've read and re-read the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.