Hello,
This is happening because the deletePeak() function is looping over the
peaks as it is deleting them. This causes a problem with the list
returned by argServer.getCurrentPeaks() because other code is
automatically modifying that list when a peak is deleted. Looping over a
list that is being modified is a big no-no in Python. The work around
here is to do:
peaks = argServer.getCurrentPeaks()
peaks = peaks[:] # this makes a copy of the list
deletePeak(peaks)
Wayne
On Thu, 5 Apr 2012, Patrick van der Wel wrote:
> Hi,
>
> I was trying to put together a simple macro in which some peaks get deleted. When I use the "deletePeak(peaks)" function, this kind of happens, except that it deletes all but one of the selected peaks. (Having prepopulated the peaks with the current peak selection).
>
> Is this a bug in that command? Is there some better code to do this?
>
> Patrick
|