• Register

Recent questions tagged typeerror

0 votes
0 answers 3 views
Problem: exception occuredtypeerror: cannot read property 'setpkcs11ui' of undefined
asked 2 days ago Sofia Castro 3.8k points
0 votes
1 answer 3 views
Problem: I am looking to make a loop so that for each element in the list, it will get broken down into each of it's characters. For example, say the number 137 was in the list then it would be turned into [1,3,7]. Then I want to add these numbers together (I ... it). However, I keep getting the error message TypeError: 'int' object is not iterable when I try and run this. What am I doing wrong?
asked 3 days ago Mashhoodch 9.1k points
0 votes
1 answer 5 views
Problem: I created a function to count a letter for example letter e. My function looks something similar to this: def count_letter(sentence, accents, case): lower_case_e = ['e'] upper_case_E = ['E'] accent_lower_case = ['é', 'ê', 'è'] accent_upper_case = ['É', ' ... and depending if it is lower or upper case or if it has accents, to sum the letters together. I created a text file called sentence
asked 3 days ago Mashhoodch 9.1k points
0 votes
1 answer 6 views
Problem: I've programmed these for calculating Variance import pandas as pd import xlrd import numpy as np import matplotlib.pyplot as plt credit_card=pd.read_csv("default_of_credit_card_clients_Data.csv",skiprows=1) print(credit_card.head()) for col in credit_card: var[col]=np.var(credit_card(col)) print(var)
asked 3 days ago Mashhoodch 9.1k points
0 votes
1 answer 12 views
Problem: I am following instructions for a class homework assignment and I am supposed to look up the top 200 most frequently used words in a text file. Here's the last part of the code: fdist1 = FreqDist(NSmyText) vocab=fdist1.keys() vocab[:200] But when I ... 1, in <module> TypeError: 'dict_keys' object is not subscriptable Any suggestions on how to fix this so it can correctly return an answer?
asked 5 days ago Mashhoodch 9.1k points
0 votes
1 answer 14 views
Problem: What's wrong with the following code (under Python 2.7.1): class TestFailed(BaseException): def __new__(self, m): self.message = m def __str__(self): return self.message try: raise TestFailed('Oops') except TestFailed as x: print x
asked 5 days ago Mashhoodch 9.1k points
0 votes
1 answer 65 views
Problem: when I make a function call to this method create({'1','2'}) I get an TypeError: 'set' object is not subscriptable error on line 'AWS': list(map(lambda id: f"arn:aws:iam::{id}:root", ids[i:i + 200])). Coming from a java background, is this somehow related to typecasting? Does the error mean that I'm passing a set data structure to a list function? How could can this be resovled?
asked Feb 19 Mashhoodch 9.1k points
0 votes
1 answer 8 views
Problem: error typeerror: cannot read property 'length' of undefined
asked Feb 18 Ethan ross 1.8k points
0 votes
1 answer 7 views
Problem: I am novice to Python and following a tutorial. There is an example of list in the tutorial : example = list('easyhoss') Now, In tutorial, example= ['e','a',...,'s']. But in my case I am getting following error: >>> example = list('easyhoss') ... , line 1, in <module> TypeError: 'list' object is not callable Please tell me where I am wrong. I searched SO this but it is different.
asked Feb 18 Mashhoodch 9.1k points
0 votes
1 answer 13 views
Problem: I have this python program that adds strings to integers: a = raw_input("Enter a: ") b = raw_input("Enter b: ") print "a + b as strings: " + a + b a = int(a) b = int(b) c = a + b str(c) print "a + b as integers: " + c I get this error: Python: TypeError: cannot concatenate 'str' and 'int' objects How can I add strings to integers?
asked Feb 17 Mashhoodch 9.1k points
0 votes
1 answer 5 views
Problem: I've got two lists of coordinates, they look like this: list_kp2_ok: [[1185.60009765625, 933.6000366210938], [1310.4000244140625, 828.0000610351562], [1067.0, 979.0], [1310.0, 828.0], [1423.2000732421875, 814.800048828125], [1306.0, 828.0], [3634.0, 605.0 ... 828.6107788085938]] Now I need to check if there are any same coordinates on both lists and create a new list of them. So I wrote:
asked Feb 17 Mashhoodch 9.1k points
0 votes
1 answer 5 views
Problem: So, I'm not entirely sure what's going on here, but for whatever reason Python is throwing this at me. For reference, it's part of a small neural network I'm building for fun, but it uses a lot of np.array and such, so there's a lot of matrices ... type clash. Maybe somebody can help me figure this out, because I've been staring at this error for too long without being able to fix it.
asked Feb 16 Mashhoodch 9.1k points
0 votes
1 answer 7 views
Problem: typeerror: unsupported operand type(s) for +: 'nonetype' and 'str'
asked Feb 15 Ethan ross 1.8k points
0 votes
1 answer 7 views
Problem: I'm playing with both learning python and trying to get github issues into a readable form. Using the advice on How can I convert JSON to CSV? I came up with this: import json import csv f=open('issues.json') data = json.load(f) f.close() f=open("issues.csv" ... item["labels"], item["state"]]) Where "issues.json" is the json file containing my github issues. When I try to run that, I get
asked Feb 15 Mashhoodch 9.1k points
0 votes
1 answer 9 views
Problem: What the traceback error is pointing out is the misuse of for statement: for i in Updt():. for in python 3 i "Python's for statement iterates? How function' object is not iterable. from getWords import getWords unique = [] def findUniqueWords(words): for word in words
asked Feb 15 Mashhoodch 9.1k points
0 votes
1 answer 21 views
Problem: I am providing two values (mon_voltage and core_voltage) via the command line and I need to find a "starting point" from a two dimensional array where my iteration or loop will start from. Here is my code: myArray = [[1.02,1.13],[1.02,1.16],[1.02,1. ... : can only concatenate tuple (not "int") to tuple I can't figure out why start_point, which is an index, is a tuple. Please help.
asked Feb 13 sasha 8.7k points
0 votes
1 answer 17 views
Problem: I'm making a small program for math (no particular reason, just kind of wanted to) and I ran into the error "TypeError: 'NoneType' object is not subscriptable. I have never before seen this error, so I have no idea what it means.
asked Feb 4 Mashhoodch 9.1k points
0 votes
1 answer 12 views
Problem: I have been banging my head against this for two days now. I am new to python and programming so the other examples of this type of error have not helped me to much. I am reading through the documentation for lists and tuples, but haven't found anything ... be much appreciated. Not looking for the answer necessarily, just more resources on where to look. I am using Python 2.7.6. Thanks
asked Jan 27 Mashhoodch 9.1k points
0 votes
1 answer 8 views
Problem: I have been banging my head against this for two days now. I am new to python and programming so the other examples of this type of error have not helped me to much. I am reading through the documentation for lists and tuples, but haven't found anything ... would be much appreciated. Not looking for the answer necessarily, just more resources on where to look. I am using Python 2.7.6.
asked Jan 26 Mashhoodch 9.1k points
0 votes
1 answer 13 views
Problem: The Python &ldquo;typeerror: 'list' object is not callable&rdquo; error is raised when I try to access a list as if it were a function. To solve this error, make sure square brackets are used to access or change values in a list rather than curly brackets.
asked Jan 24 Mashhoodch 9.1k points