Hello,
I think a common topic with typical errors would be useful...
I wanna start with the error: "'tuple' object is not callable".. What I wanted to do? I wanted to pass a tupel as a parameter to a called function. The Tupel should to contain to ints as matrix index for an neopixel matrix? What did I do wrong? What does this error, mean? There are no out or inout parameter in python, or am I wrong?
What do you think, of an common error topic? I am eager to hear from you.
Typical Python errors
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_carter
- Posts: 29189
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Typical Python errors
Can you post the full code you are having issues with.
- tannewt
- Posts: 3305
- Joined: Thu Oct 06, 2016 8:48 pm
Re: Typical Python errors
I'd like this troubleshooting doc to be the central place for "typical" error messages: https://circuitpython.readthedocs.io/en ... oting.html
I'd be happy to add specific errors to it that you've found.
I'd be happy to add specific errors to it that you've found.
- Mummel
- Posts: 23
- Joined: Sun Aug 23, 2015 9:12 am
Re: Typical Python errors
For what I found out while debugging the code in spyder3, was a missmatch of brackets. What I wanted to was...
x = sometuple[0]
What I did was:
x = sometuple(0)... Which is the functioncall mentioned in the error message
How I then changed the code was:
x, y = sometuple
x = sometuple[0]
What I did was:
x = sometuple(0)... Which is the functioncall mentioned in the error message
How I then changed the code was:
x, y = sometuple
- adafruit_support_carter
- Posts: 29189
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Typical Python errors
This is how to address any ordered sequence object (list, string, tuple).
This is called tuple unpacking. A pythony way of doing things.
This is the syntax for a function call, which...well...what the error message said.
Code: Select all
x = sometuple[0]
Code: Select all
x, y = sometuple
Code: Select all
x = sometuple(0)
Please be positive and constructive with your questions and comments.