TypeError: None required for void return

A forum for general discussion of the Python programming language.

TypeError: None required for void return

Postby johann99 » Fri Aug 16, 2013 6:39 pm

Hi,
I'm new to Python and this forum. Today I wanted to make some small changes concerning a python programme that I'm working on that is connected with a GUI from a CSS programme (EPICS product). I am working with top-down-design and wanted to change this part of the code
Code: Select all
if combo == "all":
                    liste = []
                    for a,b,c,d,e in zip(qdivbya,Qcont,nameiso, A1,abu2):
                        diffqa = abs(beamqdivbya - a )
                        diffqaoverqa = float(diffqa)/float(Qchosen)* A
                        if diffqa < diffqa0:
    # here another if structure, so that either shows only stable isotopes or all the isotopes
                            liste.append(a)
                            len(liste)
                            table1.setCellText(len(liste) - 1 , 0, str(c))
                            table1.setCellText(len(liste) - 1 , 1, str(b))
                            table1.setCellText(len(liste) - 1 , 2, str(d))
                            table1.setCellText(len(liste) - 1 , 3, str(a))
                            table1.setCellText(len(liste) - 1 , 4, str(diffqaoverqa))
                            table1.setCellText(len(liste) - 1 , 5, str(e))
# something is needed to update the contaminationlist in case there is no contamination! otherwise the old contamination from another row you pressed before
                if combo == "stable":
                    liste = []
                    for a,b,c,d,e in zip(qdivbya,Qcont,nameiso, A1,abu2):
                        if float(e) > 0:
                            diffqa = abs(beamqdivbya - a )
                            diffqaoverqa = float(diffqa)/float(Qchosen)* A
                            if diffqa < diffqa0:
# here another if structure, so that either shows only stable isotopes or all the isotopes
                                liste.append(a)
                                len(liste)
                                table1.setCellText(len(liste) - 1 , 0, str(c))
                                table1.setCellText(len(liste) - 1 , 1, str(b))
                                table1.setCellText(len(liste) - 1 , 2, str(d))
                                table1.setCellText(len(liste) - 1 , 3, str(a))
                                table1.setCellText(len(liste) - 1 , 4, str(diffqaoverqa))
                                table1.setCellText(len(liste) - 1 , 5, str(e))


with this part of the code


Code: Select all
                TESTS = {
                    "all": lambda a,b,c,d,e: True,
                    "stable": lambda a,b,c,d,e: float(e)>0
                }
               
                test = TESTS[combo]
               
                result = []
                for a,b,c,d,e in zip(qdivbya,Qcont,nameiso, A1,abu2):
                    if test(a,b,c,d,e):
                        diffqa = abs(beamqdivbya - a )
                        if diffqa < diffqa0:
                            diffqaoverqa = float(diffqa)/float(Qchosen)* A
                            result.append(a)
                            set_cells(table1, len(result)-1, c, b, d, a, diffqaoverqa, e)
                return result

before this I have defined a new function that is named

Code: Select all
def set_cells(table1, row, *args):
    for i, value in enumerate(args):
        table1.setCellText(row, i, str(value))

I am sorry for all the different names, the code is part of a much larger code.
Thanks a lot in advance for helping.
Best, Johann
johann99
 
Posts: 6
Joined: Fri Aug 16, 2013 2:05 am

Re: TypeError: None required for void return

Postby stranac » Fri Aug 16, 2013 6:45 pm

And your question is...what exactly?

Post the full error you get.
Also, creating an example we can run would help us in helping you.

And what weird library are you using? I've never seen that error before.
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1093
Joined: Thu Feb 07, 2013 3:42 pm

Re: TypeError: None required for void return

Postby johann99 » Sun Aug 18, 2013 2:41 pm

sorry, it was cleared. i wasn't sure why i got this error but i found it out^^ thanks still
johann99
 
Posts: 6
Joined: Fri Aug 16, 2013 2:05 am


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest