help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Windows; Invoking Octave


From: Jeff Miller
Subject: Re: Windows; Invoking Octave
Date: Mon, 26 Jun 2006 18:39:13 -0400

Check out Pexpect:
http://pexpect.sourceforge.net/

I have used it to build an interace with Maxima from Python. You should be able to do the same for Octave. Email me if you want the code I used.

All the best,
Jeff


On 6/20/06, Reidar Strand Hagen <address@hidden> wrote:
Hi

I'm using Octave on windows, and am trying to communicate with it from
Python.. whether accomplished through pipes, or simply providing a
script for octave to run is of no importance, although I would like to
somehow catch stdout in case of error-messages.. and certainly don't
want to have the GUI flash up for simply running a script.

Previously, I did this with an older Octave version without support
for Nd-arrays etc without problems. I don't remember which version
(nor where I found it, but it had an installer and didn't need
seperate install of cygwin, and was installed to ~\GNU Octave without
versionnumbering),  However, after switching to octave-2.1.73-0 from
Octave-forge can't seem to communicate with Octave in any way except
manually through the GUI: The way Octave-forge is wrapped into cygwin
is confusing the **** out of me, so I was wondering if anybody had any
tips?

regards
Reidar Strand Hagen

------

Attempting to run a script manually:


C:\Program Files\GNU Octave 2.1.73>type smallscript.txt
save abcdabcd
quit()

C:\Program Files\GNU Octave 2.1.73>"C:\Program Files\GNU Octave
2.1.73\bin\run.exe" rxvt.exe -e octave.sh smallscript.txt

C:\Program Files\GNU Octave 2.1.73>dir abcdabcd
Volume in drive C has no label.
Volume Serial Number is 31FA-E7F7

Directory of C:\Program Files\GNU Octave 2.1.73

File Not Found

-------

Attempting to run communicate through pipes:

Python 2.4.3 - Enthought Edition 1.0.0 (#69, Apr 18 2006, 15:43:47)
[MSC v.1310 32 bit (Intel)] on win32
IDLE 1.1.3

>>> import subprocess
>>> p = subprocess.Popen(r"c:\program files\GNU octave
2.1.73\bin\run.exe rxvt.exe -e /bin/sh octave.sh",shell=False, stdin=
subprocess.PIPE, stdout= subprocess.PIPE, stderr= subprocess.STDOUT)
>>> in_,out_ = p.communicate("a=5")

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in -toplevel-
    in_,out_ = p.communicate("a=5")
  File "C:\Python24\lib\subprocess.py", line 783, in communicate
    self.stdin.write(input)
IOError: [Errno 22] Invalid argument
>>>

Running as a script instead of interactive will make communicate just
return ("",None).
_______________________________________________
Help-octave mailing list
address@hidden
https://www.cae.wisc.edu/mailman/listinfo/help-octave


reply via email to

[Prev in Thread] Current Thread [Next in Thread]