ginput then show causes segfault

i'd like to plot some data, get user input, and then plot the original data and user input. when i try to show() the data i get a segfault after about ten seconds.

any clue what i'm doing wrong? using mac os x 10.5 with enthought distribution.

thanks,
drs

#!/usr/bin/env python

import pylab

x = pylab.arange(0,10,0.1)
y = pylab.sin(x)

# plot and get user input, then close fig
pylab.plot(x,y)
points = pylab.ginput(2)
points = pylab.array(points)
pylab.close()

# replot with chosen points
pylab.plot(x,y)
pylab.plot(points[:,0],points[:,1],'ko')
pylab.show()
# wait for it, wait for it...now segfault

Your code works for me in Ubuntu 8.10, mpl 0.98.5.2 (Debian package!)
and GTKAgg backend.

Goyo

···

El sáb, 21-02-2009 a las 16:26 -0800, Daniel Soto escribió:

i'd like to plot some data, get user input, and then plot the original
data and user input. when i try to show() the data i get a segfault
after about ten seconds.

any clue what i'm doing wrong? using mac os x 10.5 with enthought
distribution.

thanks,
drs

#!/usr/bin/env python

import pylab

x = pylab.arange(0,10,0.1)
y = pylab.sin(x)

# plot and get user input, then close fig
pylab.plot(x,y)
points = pylab.ginput(2)
points = pylab.array(points)
pylab.close()

# replot with chosen points
pylab.plot(x,y)
pylab.plot(points[:,0],points[:,1],'ko')
pylab.show()
# wait for it, wait for it...now segfault

I can't reproduce this here (on RHEL4 with mpl 0.98.5). What version of matplotlib is in the enthought distribution?

> python
Python 2.5.2 (r252:60911, May 7 2008, 12:40:32)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
'0.98.5.3'

What would be helpful to narrow this down is a backtrace from gdb. Just run "gdb python", then "run script.py" (where script.py is the path to the script that segfaults). When it segfaults, it should drop you back to the debugger prompt, where you can type "bt" to get a backtrace. Copy-and-paste that back here, and it may give us some clues.

Mike

Goyo wrote:

···

El sáb, 21-02-2009 a las 16:26 -0800, Daniel Soto escribió:
  

i'd like to plot some data, get user input, and then plot the original data and user input. when i try to show() the data i get a segfault after about ten seconds.

any clue what i'm doing wrong? using mac os x 10.5 with enthought distribution.

thanks,
drs

#!/usr/bin/env python

import pylab

x = pylab.arange(0,10,0.1)
y = pylab.sin(x)

# plot and get user input, then close fig
pylab.plot(x,y)
points = pylab.ginput(2)
points = pylab.array(points)
pylab.close()

# replot with chosen points
pylab.plot(x,y)
pylab.plot(points[:,0],points[:,1],'ko')
pylab.show()
# wait for it, wait for it...now segfault
    
Your code works for me in Ubuntu 8.10, mpl 0.98.5.2 (Debian package!)
and GTKAgg backend.

Goyo

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA