[Pythonmac-SIG] MacPython 2.3 and Gnuplot

Michael Johnson mdj at physics.ucf.edu
Tue Jun 10 15:59:09 EDT 2003


Thanks, Jack. This helped me track down the problem (a
mistyped path). Doing what I wanted took a newer version
of gnuplot. The easiest way is to use gnuplot and gnuplot.py
from the fink distribution. But I needed a less massive set of
downloads to recommend to some students. In the end
this worked:
   MacPython 2.3 including Numeric 22.0
   gnuplot 3.8h
        (I used  
http://lee-phillips.org/info/Macintosh/gnuplot_binaries.pax.Z
          installed into /usr/local/bin/gnuplot .)
   gnuplot.py 1.6 (installed using "/usr/local/bin/python setup.py  
install")

It was also necessary to set gnuplot's explicit path in gp_macosx.py,
which is in directory
/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
packages/Gnuplot ,
by changing the line
     gnuplot_command = 'gnuplot'
to
     gnuplot_command = '/usr/local/bin/gnuplot'

This version of gnuplot requires explicitly setting the terminal type
to aqua, for instance by using
     g = Gnuplot.Gnuplot()
     g('set terminal aqua')
(The fink gnuplot uses aqua as the default terminal.)

Cheers,
Michael Johnson

On Thursday, June 5, 2003, at 03:28  PM, Jack Jansen wrote:

> There are two things with PythonIDE that could make a difference (at  
> least, two things that I can quickly come up with:-) when it is run  
> from the Finder:
> - The working directory for PythonIDE is funny, I think it is "/".
> - stdin/stdout/stderr are funny. stdin is closed (or maybe  
> /dev/null?), stdout and stderr go to the console. Note that this only  
> matter for programs started by the IDE: Python scripts get a fairly  
> normal-looking sys.stdin/stdout/stderr pointing to the output window.
>
> First thing I would try is running the IDE from a Terminal window with
> % /Applications/MacPython-2.3/PythonIDE/Contents/MacOS/PythonIDE
> and see what happens then. There's a good chance that gnuplot will  
> work in this IDE, because it doesn't have the funny behaviour sketched  
> above. If it doesn't work you may get interesting output from gnuplot  
> in your terminal window. If it does not work you could run the IDE  
> from the Finder again, and use the Applications->Utilities->Console  
> application to see whether gnuplot gives any output on the console.
>
> On donderdag, jun 5, 2003, at 18:34 Europe/Amsterdam, Michael Johnson  
> wrote:
>
>> I am close to getting Gnuplot and Gnuplot.py to work with MacPython  
>> 2.3,
>> but not quite there. It works with the command line  
>> /usr/local/bin/python
>> but not with PythonIDE. I hope someone here can straighten me out.
>>
>> I installed MacPython 2.3b1 and then used Package Manager to install
>> Numeric-22.0-binary.
>>
>> Separately I installed gnuplot-3.7.1, which works fine (with  
>> aquaterm).
>>
>> I downloaded gnuplot-py-1.6. Since MacPython 2.3 installs a  
>> command-line
>> version in /usr/local,  I used this to install gnuplot.py by running  
>> the command
>> "/usr/local/bin/python setup.py install" within the gnuplot.py  
>> directory.
>>
>> This installs gnuplot.py in what appears to be the right place:
>> /Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- 
>> packages/Gnuplot
>>
>> The result  works beautifully using the command-line version of  
>> python.
>> For instance, cd'ing  to the Gnuplot directory just above and issuing  
>> the
>> command "/usr/local/python demo.py" works as advertised.
>>
>> However, I can't get Gnuplot to work using the IDE. It successfully  
>> imports
>> Numeric and  Gnuplot. But when issuing gnuplot commands like those in
>> the demo.py it fails with the error
>>     "IOError: [Errno 32] Broken pipe."
>> The traceback points to self.flush() in gp_macosx.py. I tried playing  
>> with the
>> gnuplot_command variable in  gp_macosx.py (to point directly to the  
>> unix
>> gnuplot command), to no avail.
>>
>> So my question is: can I get Gnuplot.py to work with MacPython's IDE?
>>
>> Thanks for any clues.
>> Michael Johnson
>>
>>
>> _______________________________________________
>> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>>
> --
> - Jack Jansen        <Jack.Jansen at oratrix.com>         
> http://www.cwi.nl/~jack -
> - If I can't dance I don't want to be part of your revolution -- Emma  
> Goldman -
>




More information about the Pythonmac-SIG mailing list