Questions tagged [nonetype]

Nonetype refers to an object or type whose value is null (none).

Filter by
Sorted by
Tagged with
1 vote
0 answers
21 views

Kaggle: cannot unpack non-iterable nonetype object

I have a problem when i try to indexing and masking my data I know this question has been asked before but I can't seem to get mine to work. train = pd.read_csv('/kaggle/input/twitter2/train.csv', ...
Vito Rozaan's user avatar
0 votes
1 answer
49 views

In python selenium get_attribute('value') does not return None when attribute does not exist in web element

I have a textbox in a form and I want to know if its blank. get_attribute() should return None if the attribute does not exist, but it's returning nothing, blank, empty space. I want to check that the ...
charm2023's user avatar
0 votes
0 answers
53 views

How should we solve this error"argument of type 'NoneType' is not iterable"?

This is my code about a program to make a weekly plan for schools but I came across an error : def teacher_validator_tenth(): valid_lesson_teacher = {'Math':['Jones'],'Physics':['Baker','...
z.m's user avatar
  • 1
2 votes
1 answer
70 views

NoneType error when trying to access .text attribute of an existent <a> element

I am using BeautifulSoup to scrape the first wikitable on the page List of military engagements during the Russian invasion of Ukraine to get the names of all 57 battles. I have attached an image of ...
Kai Garcia's user avatar
0 votes
0 answers
21 views

Extract report from Qlikview desktop_with python

the part of the script with the error looks like this : ActiveDoc = qvapp.OpenDoc(doc) # Open QlikView application print('Extracting:', qv_object_id) ActiveDoc.GetSheetObject(qv_object_id).Export(...
Dumitru J.'s user avatar
0 votes
1 answer
52 views

AttributeError: 'NoneType' object has no attribute 'text' trying to scrape data in Fbref

I am doing a project that involves scraping some data from FBref, and im using a code i found on git that does exactly what i want. This is the code: def get_tables(url): res = requests.get(url) ...
tomas moro's user avatar
-2 votes
1 answer
57 views

TypeError: unsupported operand type(s) for ** or pow(): 'NoneType' and 'int'

Can someone please answer my question? Why am I getting the error message "TypeError: unsupported operand type(s) for ** or pow(): 'NoneType' and 'int'", when I run the following code? ...
Baziga's user avatar
  • 15
2 votes
2 answers
71 views

Always returns 'None' when trying to get an element from web page

I'm trying to get the wins from the 'Overall match stats' on this page: https://www.fctables.com/teams/sunderland-194998/?template_id=11. Everything I try it just returns 'None'. This isn't the only ...
Xdvanced's user avatar
0 votes
2 answers
60 views

Pandas filling NaN values with a string value and keeping None values as the same [duplicate]

I have a dataframe with mixed datatypes. I would like to fill NaN values but keep None values as the same. I tried to use fillna() method from pandas but the function is filling both NaN and None ...
Cansu Zöhre's user avatar
2 votes
1 answer
133 views

How to loop through column in excel until an empty cell

I have written some python code that loops through an excel sheet and extracts the strings from the cells. I wish the loop to stop once it reaches an empty cell. I can get this to work if I put a ...
user22005575's user avatar
1 vote
0 answers
153 views

AttributeError: 'NoneType' object has no attribute 'is_finalizing' when using Dask and distributed.Future

I am currently working on a project that involves using Dask for parallel and distributed computing. I've been encountering an issue related to the distributed library, specifically when working with ...
Nicolás Andrés Ganter Horst's user avatar
0 votes
1 answer
72 views

I keep on getting: TypeError: '>=' not supported between instances of 'NoneType' and 'int'

secInmin = 60 secInhour = 3600 secIndays = 86400 secondsInput = print(float(input('Input any number of seconds: '))) Sc = secondsInput *if (secondsInput >= secInmin): userSec = ...
Thundoisking's user avatar
0 votes
1 answer
37 views

Python: How to scrape contents of list tag inside the head tag with specific text

import requests and BeautifulSoup I want to scrape the "Objectives" part, but there is an error like below. AttributeError: 'NoneType' object has no attribute 'next_sibling' Also, I want to ...
SK Kim's user avatar
  • 11
0 votes
0 answers
10 views

why none output in list method? [duplicate]

so where from "None" came in my output a=[19,20,21] print(a) b=a.insert(1, 1907) print(b) when i write this code it give me this output [19, 20, 21] None BUT the output should be [19, 20, ...
Dev Soni's user avatar
0 votes
2 answers
13 views

Python object not recognized as JPG despite previous manipulations

I am writing a program that pastes one jpeg onto another, however one of my functions stops recognizing an object as a jpeg file for unknown reasons. My output is "inside_select_letter_to_paste, ...
pblnxblndr's user avatar
0 votes
1 answer
36 views

How to get a none type answer from the user?

I am trying to get a none type input from the user in Python. My program is that of a news channel, you write a period of time and it shows you the news of that period but I want my program to work so ...
just needed's user avatar
0 votes
0 answers
63 views

My Python code runs successfully, but when imported as a module it gives 'cannot unpack non-iterable NoneType object'

import os import sys import shutil from src.logger import logging from src.exception import CustomException from dataclasses import dataclass ## intitialize the Data Ingestion configuration @...
Karan Kumar's user avatar
-1 votes
1 answer
39 views

Why this function is not returning an integer instead returning a none type in python?

Here I am trying to get a reversed integer but instead I am getting a none type when I am passing a negative integer to the function. Can you identify the logic mistake I did. Here is the code that I ...
Narayana Reddy's user avatar
0 votes
1 answer
14 views

Prophet Error: tick_w = max(df_none['horizon'].astype('timedelta64[ns]')) / 10

I am using Prophet version 1.4 with Anaconda on a 64 bit machine and get the following error: tick_w = max(df_none['horizon'].astype('timedelta64[ns]')) / 10. The type of error is: TypeError: '...
Mansour Shams's user avatar
0 votes
1 answer
130 views

Polars Dataframe change null to np.nan in Int row when use .to_numpy()

In polars, we can use .to_numpy() to change a polars.DataFrame into numpy.ndarray. But if there are None value, polars will change them into null, when use to_numpy(), null value will be change to np....
Rolnan's user avatar
  • 23
1 vote
1 answer
7k views

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' [duplicate]

from dataclasses import dataclass @dataclass class InventoryItem: """Class for keeping track of an item in inventory.""" name: str | None = None unit_price: ...
jetgreen's user avatar
0 votes
1 answer
166 views

Appease mypy where None is type hinted and other operands are used

I have 2 pieces of code where default values could be None, but the None values are caught before the operation (>) or iteration of a list. Mypy is still producing an error message despite the fact ...
Pete's user avatar
  • 33
0 votes
1 answer
30 views

Conditionals with possible None values in List comprehension

I have a xml file that lists speakers: <speakerlist> <speaker> <title>Dr.</titel> <firstname>Bernd</firstname> <lastname>Baumann&...
Quantum's user avatar
  • 520
0 votes
1 answer
22 views

Postcode lookup: nonetype object not subscriptable

I've got what I think is a super basic problem, but it's got me stumped... I've got a bunch of longitude/lattitude coordinates in a dataframe and want to look up what UK postcode they are in, and ...
Alastairstirling's user avatar
0 votes
4 answers
60 views

'NoneType' object has no attribute 'next_element'

There is a website with this html-code and only one itemprop="brand": <dd itemprop="brand" class="attributeValue-2574930263"> <a class="link-3970392289 ...
Alberi's user avatar
  • 13
0 votes
1 answer
9 views

NoneType not callable, BeautifulSoup

#Below is my code import requests from bs4 import BeautifulSoup import pandas as pd response = requests.get('https://www.google.com/maps/search/dance+studio') soup = BeautifulSoup(response.content, '...
Ahmed's user avatar
  • 3
0 votes
0 answers
70 views

Unable to set value to None unless set to string first

I Have a list of pandas series: stagedInserts. I'm looping through each key-value in each series within a list to (among other things) weed out any np.nan values and set the value to None. This is ...
neanderslob's user avatar
  • 2,633
0 votes
1 answer
29 views

Webscraping with BeautifulSoup AttributeError: 'NoneType' object has no attribute 'find'

I need your help. Where did I a mistake in a code? I'm trying to scrap a website with BeautifulSoup: Could you help me to fix and solve this problem? I checked my code, tried to fix the problem, but ...
Andrejus Jaroslavcevas's user avatar
-1 votes
1 answer
50 views

Why do I get "None" as output for a function? Also, how to make a function run for both strings and numbers?

The question is : Write a function called merge that takes two already sorted lists of possibly different lengths, and merges them into a single sorted list, without using the inbuilt sort function ...
218 Mani kumar's user avatar
0 votes
0 answers
59 views

TypeError: 'NoneType' object is not subscriptable | Forza horizon 4 Telemetry

I try to make an ia on Forza Horizon 4 so I try to receive the telemetry info but it don't work. The Code : UDP_IP = "127.0.0.1" UDP_PORT = 5005 sock = socket.socket(socket.AF_INET, # ...
lxlxtoto's user avatar
1 vote
0 answers
317 views

Python AttributeError: 'NoneType' object has no attribute 'find'

I'm trying to scrap a simple website. but facing issue with "NoneType" object has no attribute "find". can anyone help to find out what is the problem with it import requests from ...
Tusar Ahmed's user avatar
0 votes
2 answers
215 views

AttributeError: 'NoneType' object has no attribute 'append'! Why does my List become a NoneType?

So I'm doing this project for work. I create two lists, both made up of strings. I call the first one "wordlist_line1" and the second "titles". wordlist_line1 = ["2023-06-09&...
Ilia's user avatar
  • 1
-2 votes
1 answer
26 views

Why printing some inbuilt methods return VALUES while some NONE?

I am trying to understand the differences in output between the following code snippets: arr = [1, 2, 3, 4, 5] print(arr.sort()) // Output: None print(arr.pop()) // Output: 5 In the first snippet, I ...
malavi pande's user avatar
0 votes
1 answer
39 views

TypeError: 'NoneType' object is not subscriptable, in a HTML

I am new to coding and I learning about web scrapping using beautiful soup. I try to extract out a None Type from a HTML file but I dont get it how to solve this problem Also there is a list that I ...
jwo jiunn Kon's user avatar
0 votes
1 answer
44 views

How to get output value of Nonetype variable as integer

Please need help. I want to pick an output value from a nonetype variable and subtract it from an integer variable i wrote down an input box but am not able to pick the value from the assigned ...
Alucard's user avatar
1 vote
0 answers
72 views

Getting TypeError: cannot unpack non-iterable NoneType object for Flask(__name__) python3

I am getting "TypeError: cannot unpack non-iterable NoneType object" while trying to run the simple flask web application. Code Snipet: from flask import Flask, redirect, url_for, ...
ankur yadav's user avatar
0 votes
2 answers
1k views

Error in Python: TypeError: '<' not supported between instances of 'str' and 'NoneType'

So I have some code in Python that is supposed to take 3 integers and compare them to each other and then determine which of the three integers are the smallest and largest values. When I run the code,...
Esravei's user avatar
  • 23
-3 votes
2 answers
59 views

Getting 'Nonetype is not callable' error but I don't know why

I'm trying to create a reaction time game thing, however when I press enter after the hotkey is added I get a super long Nonetype error making reference to several different files. import time import ...
Irrelevant_YT's user avatar
0 votes
0 answers
186 views

MoviePy Error by using concatenate_videoclips: AttributeError: 'NoneType' object has no attribute 'get_frame'

I try to concatenate a hand full of video files (~70) by using the function concatenate_videoclips() from MoviePy. This is the code is used: def merge_and_write_videos(clip_list, export_file): ...
JanHarm22's user avatar
1 vote
1 answer
116 views

Is this PyCharm-inspection a false positive? "Cannot find reference '__class__' in 'None'"

In my codebase there is some amount of None.__class__. PyCharm marks this as as a warning: Cannot find reference '__class__' in 'None' I am using PyCharm 2022.3 (Community Edition) if that matters. ...
julaine's user avatar
  • 517
1 vote
1 answer
822 views

AttributeError: 'NoneType' object has no attribute 'lower' In a machine learning application in Python

These are my codes that I get an error when I run: def my_tokenizer(text): if text is None: return [] else: return text.split() vectorizer = CountVectorizer(tokenizer=...
nes's user avatar
  • 23
0 votes
1 answer
54 views

Having problems creating a range for "NoneType"

I am a student trying to create a range of coordinates for a ball detector on pi-top 4. if blue_ball.found: print(f"Blue ball center: {blue_ball.center}") print() ...
Kai_Q's user avatar
  • 19
1 vote
0 answers
634 views

Llama_index index.query returns proper response when .py file is run via CLI but return "None" when used with (Django)api call

I am trying to het a response from openai. This works fine when I run the file form the CLI.(see code below) Because it prints the response to the command line. from django.views.decorators.csrf ...
user21733543's user avatar
0 votes
0 answers
22 views

returning index from a list [duplicate]

I want to return the index(0) from the list in the shown code but it returns None and when I tried to print index(0) it printed 1 so I want to know how to return the index class Solution: def ...
Alidiab's user avatar
  • 21
0 votes
0 answers
28 views

append is randomly causing errors

I am trying to append the new user inputs and for some reason it will give me a NoneType error when I try to use addAccount more than once but then will randomly work more than once. def ...
Sock's user avatar
  • 1
0 votes
1 answer
37 views

Invert binary tree; getting Nonetype error when i have specifically asked to proceed only if the node is not None

#code taken from leetcode so treenode is predefined # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # ...
User_04_04_2023's user avatar
0 votes
0 answers
18 views

Why I am getting TypeError: 'NoneType' object is not subscriptable in the code in lastfm 1k dataset?

I am getting TypeError: 'NoneType' object is not subscriptable in the code of lastfm 1K dataset>df['artistid'] = pd.to_numeric(df['artistid'], errors='coerce') and the artist id is in the format ...
Sauron Gulron's user avatar
1 vote
3 answers
122 views

Since when is Python None equal to None?

I always thought that Python nulls are not equal, as is common in many other languages and based on simple logic (if the value is unknown, how can it be equal to another unknown?). However, recently I ...
Dommondke's user avatar
  • 382
0 votes
0 answers
23 views

Error: 'NoneType' object has no attribute 'get_text'

While trying to do the popular amazon web scraping project, an error: object has no attribute get_text happens. Any way to resolve this? I tried "html.parser", 'lxml', 'html5lib' and there's ...
Ameti'obong's user avatar
0 votes
1 answer
135 views

How to ignore NULL or None values when fetching from a Database

Excuse me if this is an easy fix, I'm very new to python and sqlite3. Basically my problem is that when I try to fetch the top 3 best average times from my database, it instead outputs 3 Students who ...
Lily Crawford's user avatar

1
2 3 4 5
27