Questions tagged [typeerror]

A TypeError is a specific type of error raised when an operation or function is applied to an object of inappropriate type. You might encounter it in Python or JavaScript.

A TypeError often occurs during operations on two data types.

An example is given below, in which an attempt is made to add an integer to a string:

>>> 3 + "string"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'
>>>

Note that this behavior is not universal; some languages do not require two of the same data type to perform operations.

5623 questions
1
vote
1 answer

react js blueprintjs Date Range Picker not work

I need create DateRangePicker on BlueprintJS(documentation) and RangePicker in my component, like in this screenshot. I instalation all npm packages, and do all by instructions: import { DateRangePicker } from…
1
vote
1 answer

Error in express app when changing from .use(req,res) to using a routes.js file

I have a site in express and am trying to convert it to use a routes.js file to clean things up. I am getting a TypeError, explained below. I have read this and this but I still can't figure it out. Currently the site works with the following…
garson
  • 1,395
  • 3
  • 19
  • 45
1
vote
3 answers

Error: 'List' object is not callable in map() function

def powerof(num): return num**2 number = [1,2,3,4,5,6,7,8] s = list(map( powerof , number)) print(s) Error : 'list' object is not callable
NoobCoder
  • 302
  • 1
  • 3
  • 11
1
vote
2 answers

How to fix error "missing positional argument: 'on_delete'" when use django-notifications?

Please help me with this: File "C:\Python36\lib\site-packages\notifications\models.py", line 170, in Notification recipient = models.ForeignKey(settings.AUTH_USER_MODEL, blank=False, related_name='notifications') TypeError: __init__() missing 1…
1
vote
2 answers

Object not callable

I am currently working on this code for my homework assignment involving Matrix Implementation: class MyMatrix(object): def __init__(self, n, m, t): self.n = n self.m = m self.t = t self.data = [] for i…
Kayla Stewart
  • 31
  • 1
  • 4
1
vote
1 answer

Type Error takes 1 positional argument but 4 were given

I am currently working on this code for my homework assignment involving Matrix Implementation: class MyMatrix(object): def __init__(self, n, m, t): self.n = n self.m = m self.t = t self.data = [] for i…
Kayla Stewart
  • 31
  • 1
  • 4
1
vote
1 answer

python, dijkstra's shortest path, type error - generator does not suppport item assignment

i recently posted a question to do with my project because i encountered an error, that error was solved but it led to a new different error that i thought would be better off being asked in a new question #if user wants a small map i.e. less than…
aidan
  • 85
  • 1
  • 2
  • 8
1
vote
3 answers

Why do I get TypeError: 'int' object is not subscriptable using for loop and not with list-comprehension in python

This returns a type error difference = [1, 2, 3, 4, 5] for i in range(len(difference)-1): difference = difference[i+1] - difference[i] But this works fine difference = [difference[i+1]-difference[i] for i in range(len(difference)-1)] What…
1
vote
1 answer

React Updater function doesn't work. Regular setState somehow does? (Cannot read property 'name' of null)

Today I learned about updater functions, and that it's better to use them, because of React 16's fibre core. Here is the code that doesn't work: handleChange(e) { this.setState((state, props) => ({ [e.target.name]: e.target.value …
J. Hesters
  • 8,261
  • 15
  • 78
  • 164
1
vote
1 answer

Decimal point acting bad - ValueError: could not convert string to float: '.'

I have SP500 data downloaded from the Fed, a very simple .csv file with two fields; date and price. When I do a pd.read_csv() to load into a dataframe I get two errors: TypeError: Cannot cast array from dtype('O') to dtype('float64') according to…
1
vote
1 answer

Type error in explicitly typed binding - Haskell

I've been struggling for like an hour to understand some things in higher order functions and now I am at the point that I cannot move any further because of this error: hof :: [Integer] -> (Integer -> Integer) isIn :: [Integer] -> Integer…
1
vote
1 answer

Cannot assign value of type 'SlideAnimation.Type' to type 'UIViewControllerTransitioningDelegate?

I'm trying to add custom segue animations to my app but keep getting this error: Cannot assign value of type 'SlideAnimation.Type' to type 'UIViewControllerTransitioningDe My ViewController code: import UIKit class ViewController:…
Laurcode
  • 17
  • 3
1
vote
0 answers

Python-script, which should translate 1000 DNA-Sequences to proteins by 1152 different codontables, don't work

Now I'm working on bioinformatics project for my diploma work. I have written Python-script, which should translate the list of strings of 1000 DNA-Sequences to proteins by 1152 different codontables (genetics codes). This codontables are contained…
1
vote
1 answer

Combine graphs in tensorflow

I don't know how to approach this. I have one graph, g1 which is used to extract features. class FeatureExtractor(): self.g1 ... def _build_model(): ... def compute_features(new_in): out =…
Isaac
  • 814
  • 2
  • 12
  • 25
1
vote
1 answer

How to get the value using react-rating component in my form?

I'm using React Rating (https://github.com/dreyescat/react-rating) and I'm not sure how to use get the value for my ratings. All of my other fields are working. I put in a console.log to see that their values have changed. When I try to click on a…
Kathy
  • 97
  • 2
  • 11
1 2 3
99
100