help-octave
[Top][All Lists]
Advanced

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

Calling Octave from Python


From: Maurice Ling
Subject: Calling Octave from Python
Date: Mon, 16 Aug 2004 12:43:42 +1000
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Gecko/20040113

Hi,

I've been trying to find a way to call Octave from Python and a previous message in this list uses the following codes...

import os
import string

# make sure to call ocatve with the "quiet" flag
[pwrite, pread] = os.popen2("octave -q","w")

pwrite.write("x = [1,2,3];\n")
pwrite.write("printf('%f\\n', sum(x));\n")

# always flush the output to avoid deadlocks
pwrite.flush()
result = pread.readline()
print ("Sum = %f" % string.atof(result))

pwrite.close()
pread.close()


But python freezes itself after "result = pread.readline()". I'm wondering what is wrong?

Thanks
Cheers
Maurice

--
Maurice Han Tong LING, BSc(Hons)(MCB), AdvDipComp, SN
Doctor of Philosophy (Science) Candidate, The University of Melbourne
mobile: +61 4 22781753
        +65 96669233
mailing address: Department of Zoology, The University of Melbourne
                 Royal Parade, Parkville, Victoria 3010, Australia
residential address: 9/41 Dover Street
                     Flemington, Victoria 3031, Australia
email: address@hidden
resume: http://maurice.vodien.com/maurice_resume.pdf
www: http://www.geocities.com/beldin79/

The information contained in this message, including its attachment(s), is CONFIDENTIAL and solely intended to its addressee(s) only. The content of this message, including its attachment(s), may be subjected to copyright and privacy laws. If you have received this email in error, please let me know by returning this email, and then destroy all copies.

"I cannot discover anyone knows enough to say definitely what is and what is not possible" -Henry Ford "The difference between the impossible and the possible lies in a person's determination" -Tommy Charles Lasorda

Attachment: mauriceling.vcf
Description: Vcard


reply via email to

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