[buug] Teaching myself Python, (&Gnuplot&Unix) not playing correctly
Paul Ivanov
pi at berkeley.edu
Mon Jul 12 17:01:34 PDT 2010
Steve,
is the usage of gnuplot negotiable - i.e. do you just want to be able to
plot stuff, or do you *HAVE* to use gnuplot for some particular reason?
gnuplot itself is a command-line utility, so to me it seems awkward to
use it with python and communicate via pipes. Also, a quick search
reveals that the gnuplot.py module you're using has not been updated in
over 2 years - whereas numpy has seen a lot of changes in the same time
frame. The error you're receiving looks more fundamental than this, but
beware that there may be issues once you resolve your current error.
If you have IPython installed (if you don't, you should ;)), run the
same script using
In [1]: run demo.py
and after the crash, type debug
In [2]: debug
which will get you into the ipdb> prompt, so you can go up and down the
stack and look at the variables to help you figure out what's going
wrong. Alternatively, you can turn automatic debugging of every crash
using the 'pdb on' ipython command.
If Gnuplot itself isn't a requirement, there's an excellent publication
quality python plotting library called matplotlib [1]. It is actively
developed, and is based on numpy, which is usually a non-trivial
dependency, except that you've already got it! As a member of the
extended SciPy community for the past 2-3 years, I'd say the
overwhelming majority of people using numpy and scipy for their work
turn to matplotlib for generating their 2D graphs and figures.
best,
Paul Ivanov
[1] <http://matplotlib.sourceforge.net/>
Steve Sands, on 2010-07-12 15:59, wrote:
> Johan, All,
> PATH:
> ssands$ $PATH
> -bash:
> /Library/Frameworks/Python.framework/Versions/2.6/bin:/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin:
> No such file or directory
>
> This is one of my problems, is that I am uncertain where to place all the
> various components of the software.
>
> Gnuplot.app is in the applications folder (v4.2.5)
>
> I also have in the site-packages folder, a folder labeled gnuplot-py-1.8
> which contains:
>
> computer:/Applications/Python_2.6/site-packages/gnuplot-py-1.8 ssands$ ls
> ANNOUNCE.txt LICENSE.txt README.txt
> doc gp_java.py setup.cfg
> CREDITS.txt MANIFEST.in TODO.txt
> funcutils.py gp_mac.py setup.py
> Errors.py NEWS.txt _Gnuplot.py
> gnuplot_Suites.py gp_macosx.py termdefs.py
> FAQ.txt PKG-INFO __init__.py
> gp.py gp_unix.py test.py
> Gnuplot.html PlotItems.py demo.py
> gp_cygwin.py gp_win32.py utils.py
>
> Also in the site-packages folder, is Gnuplot:
>
> computer:/Applications/Python_2.6/site-packages ssands$ ls
> Gnuplot gnuplot-py-1.8
> numpy scipy-0.7.2-py2.6.egg-info
> wxredirect.pth
> README gnuplot_py-1.8-py2.6.egg-info
> numpy-1.4.1-py2.6.egg-info setuptools-0.6c11-py2.6.egg
> easy-install.pth nose-0.11.3-py2.6.egg scipy
>
> The Gnuplot folder contains:
>
> computer:/Applications/Python_2.6/site-packages/Gnuplot ssands$ ls
> Errors.py __init__.py gnuplot_Suites.py
> gp_java.py gp_unix.py test.py
> Errors.pyc __init__.pyc gnuplot_Suites.pyc
> gp_java.pyc gp_unix.pyc test.pyc
> PlotItems.py demo.py gp.py
> gp_mac.py gp_win32.py utils.py
> PlotItems.pyc demo.pyc gp.pyc
> gp_mac.pyc gp_win32.pyc utils.pyc
> _Gnuplot.py funcutils.py gp_cygwin.py
> gp_macosx.py termdefs.py
> _Gnuplot.pyc funcutils.pyc gp_cygwin.pyc
> gp_macosx.pyc termdefs.pyc
>
> Best regards,
>
> Steve
>
>
>
>
> On Mon, Jul 12, 2010 at 3:46 PM, Johan Beisser <jb at caustic.org> wrote:
>
>> What would help is: what is your current PATH variable? Where are
>> gnuplot and its libraries installed?
>>
>>
>> On Mon, Jul 12, 2010 at 2:51 PM, Steve Sands <sandssb at gmail.com> wrote:
>>> Hello All,
>>> Newbie here.
>>> Using Mac 10.4.11; Intel Core 2; Python 2.6.5; [GCC 4.0.1 (Apple Inc.
>> build
>>> 5493)] on darwin
>>>
>>> I have downloaded gnuplot, scipy, numpy, and the demo.py file from which
>> one
>>> can glean utility on how to use gnuplot commands from within python. I
>>> managed to get this working once, and my issue seemed to be related to my
>>> PATH variable. I.E., the PATH was incorrect, and thus the demo file
>> would
>>> not work. I did copy the path variable from that session, but once I
>> closed
>>> the terminal, despite resetting the PATH, I can't quite get this demo
>> file
>>> to work again. I'm pretty sure this is something simple to rectify, but
>> I
>>> can't quite figure it out. Thus:
>>>
>>> steve-computer:/Applications/Python_2.6/site-packages ssands$ cd
>>> gnuplot-py-1.8
>>> steve-computer:/Applications/Python_2.6/site-packages/gnuplot-py-1.8
>> ssands$
>>> python demo.py
>>> gnuplot> set terminal aqua
>>> gnuplot> set title "A simple example"
>>> gnuplot> set data style linespoints
>>> sh: line 1: gnuplot: command not found
>>> Traceback (most recent call last):
>>> File "demo.py", line 110, in <module>
>>> demo()
>>> File "demo.py", line 33, in demo
>>> g.plot([[0,1.1], [1,5.8], [2,3.3], [3,4.2]])
>>> File "/Applications/Python_2.6/site-packages/Gnuplot/_Gnuplot.py", line
>>> 285, in plot
>>> self.refresh()
>>> File "/Applications/Python_2.6/site-packages/Gnuplot/_Gnuplot.py", line
>>> 226, in refresh
>>> self(self.plotcmd + ' ' + string.join(plotcmds, ', '))
>>> File "/Applications/Python_2.6/site-packages/Gnuplot/_Gnuplot.py", line
>>> 210, in __call__
>>> self.gnuplot(s)
>>> File "/Applications/Python_2.6/site-packages/Gnuplot/gp_macosx.py",
>> line
>>> 144, in __call__
>>> self.flush()
>>> IOError: [Errno 32] Broken pipe
>>> ^Z
>>> [1]+ Stopped python demo.py
>>>
>>> Just so folks are aware, I have tried discussing this with the Python
>>> community, they suggested I speak with the Unix community.
>>> Any suggestions/help would be greatly appreciated. Thanks in advance.
>>>
>>> Best regards,
>>>
>>> Steve
>>>
>>>
>>>
>>> _______________________________________________
>>> Buug mailing list
>>> Buug at weak.org
>>> http://www.weak.org/mailman/listinfo/buug
>>>
>>>
>>
>
>
>
> _______________________________________________
> Buug mailing list
> Buug at weak.org
> http://www.weak.org/mailman/listinfo/buug
More information about the buug
mailing list