Fit function attribute error

I am trying to create a fit function in MANTID which requires an attribute. I have followed the online documentation on how to do this, yet when I try to execute the script, it says that an unknown error has occurred, which causes MANTID to shut down.

My code:

class fitefunc(IFunction1D):
    
    def category(self):
        return 'Muon'
              
    # Declare Parameters for the KT function    
    def init(self):
        self.declareAttribute("BinWidth", 0.05)
        self.declareParameter("Asymmetry", 0.0)
        self.declareParameter("Delta", 0.0)
        self.declareParameter("Field", 0.0)
        self.declareParameter("nu", 0.0)

    def setAttributeValue(self, name, value):
        if name == "BinWidth":
            # Can the be accessed quicker later using self._nloops
            self._tau = value

        super(fitefunc, self).setAttributeValue(name, value)
    ....

It is the last line (the part which calls super) which is singled out by MANTID. Commenting this out stops the error.

Edit:

This is the simplest version of the script which produces the error:

from mantid.api import *
import numpy as np
import numpy.fft as ft
import math
from scipy import integrate


class fitefunc(IFunction1D):

def category(self):
    return 'Muon'
             
def init(self):
    self.declareAttribute("BinWidth", 0.05)
    self.declareParameter("Asymmetry", 0.0)
    self.declareParameter("Delta", 0.0)
    self.declareParameter("Field", 0.0)
    self.declareParameter("nu", 0.0)

def setAttributeValue(self, name, value):
    if name == "BinWidth":
        # Can the be accessed quicker later using self._nloops
        self._tau = value

    super(fitefunc, self).setAttributeValue(name, value)

# Define the fit function
def function1D(self, xvals):
    return np.ones(xvals.size)
    
FunctionFactory.subscribe(fitefunc)

You may want to post the whole script. The snippet you posted does not throw in Mantid v.3.10.0

Thanks, please see edit

This is a bug.
While this is being fixed, you can comment the super line and the function will work on scripts, but not on the MantidPlot GUI. If you need to use the GUI then you could define BinWidth as as fitting parameter and fix it ties=(BinWidth=0.78) to emulate a constant attribute.

The bug has been fixed. If you don’t use the nightly builds another way around the problem is not to define setAttributeValue at all, instead get the attribute value inside finction1d with bin_width = self.getAttributeValue(‘BinWidth’)

Thank you! I’ll give it a try