Questions tagged [nonetype]
Nonetype refers to an object or type whose value is null (none).
nonetype
1,359
questions
-1
votes
0
answers
21
views
Why I am getting this error: TypeError: Expected a Runnable, callable or dict.Instead got an unsupported type: <class 'NoneType'>
import streamlit as st
from langchain_google_vertexai import VertexAI
from langchain_core.prompts import PromptTemplate
import os
import sys
sys.path.append(os.path.abspath(''))
class QuizGenerator:
...
2
votes
2
answers
56
views
Attribute error : None type object in Linked List
I tried to create a simple single-linked list as the following:
class node:
def __init__(self, data=None):
self.data = data
self.next = None
class linkedlist:
def __init__(...
0
votes
2
answers
37
views
Python seems to return incorrect data length for NULL value from a Pandas dataframe
I am trying to find the longest value and its length from a column in a Pandas dataframe.
This column holds country codes which are strictly 2 charterers without any empty strings or spaces, but data ...
-4
votes
0
answers
83
views
Rewrite the idiom "... if foo is not None else None"
Is there a way, for example with boolean logic (or, and, ...) or another way, to replace the idiom:
... if foo is not None else None
Example: foo = int(foo) if foo is not None else None
by something ...
-8
votes
3
answers
150
views
Convert to int if not None, else keep None [closed]
I have a request dict and I need to parse some elements into either int or None. This works:
request = {"a": "123", "c": "456"}
a, b = request.get("a")...
0
votes
0
answers
29
views
I found a problem while exchainging the tensorflow backend of keras3 to the jax backend
I have a NN model based on a keras.model. It works when I use TensorFlow, but I was trying to use it for jax. So, I changed the back-end to jax and suddenly I have to create an aux variable in the ...
2
votes
3
answers
212
views
Checking for False when variable can also be None or True
Update: please see my discussion if you want to delve further into this topic! Thank you everyone for your feedback on this!
I have a boolean(ish) flag that can be True or False, with None as an ...
0
votes
0
answers
37
views
Error while running the Django exe file created by PyInstaller
I am using Pyinstaller to convert my Django project to a standalone executable file. WHen i run the exe file, i get the following error in the window. Can you please tell me what the error means and ...
0
votes
1
answer
31
views
Remove black dot when show display:'none' in view style in react native
I wrote a app with react native
in one my page I used a View with this style
display: IsShow ? "flex" : "none"
when IsShow value is false then display:'none' actived , a black dot(....
1
vote
1
answer
57
views
Workaround for "TypeError: 'NoneType' object is not subscriptable" in ArcGIS Import data Tutorial
I'm trying to follow this ArcGIS tutorial. I'm receiving a TypeError: 'NoneType' object is not subscriptable. This happens when I try to execute csv_item = gis.content.add(trailhead_properties, ...
0
votes
0
answers
8
views
TypeError: cannot unpack non-iterable NoneType object. i want get df of twelvedata.timeseries.timeSeries object how can i do this i was abl todo it b4
i'm trying to make a method that would return me a df:
while doing it i am using twelvedata.
i am getting a type error but a few days before i was able to run it without errors !
here are syntax and ...
0
votes
0
answers
28
views
Python Program: Retrieving Follower Count and Displaying Person Details Returns None
from game_data import data
from art import logo, vs
import random
print(logo)
person_one_list = []
person_two_list = []
person_first_followers = None
person_second_followers = None
def person_one()...
0
votes
0
answers
106
views
Daemon. AttributeError: 'NoneType' object has no attribute 'fileno'
Please help me with the error. I have a simple code that I run on Linux.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import daemon
import sys
from traceback import format_exc
def ...
0
votes
0
answers
80
views
Gradio Textbox - None type as input
I'm working on a recommender system that uses gradio interface for text input.
When asking for bag of words suggestions, bow_input is seen as "string" => fine
When asking for Bert ...
0
votes
1
answer
35
views
Attribute error in solving LeetCode challenge "Merge Two Binary Trees"
I'm trying to solve LeetCode problem 617. Merge Two Binary Trees:
You are given two binary trees root1 and root2.
Imagine that when you put one of them to cover the other, some nodes of the two trees ...
-1
votes
1
answer
576
views
AttributeError: 'NoneType' object has no attribute 'write' with pyinstaller and tensorflow
I'm encountering issues with an executable file created using PyInstaller. The code generates a CustomTkinter GUI for training TensorFlow models. While the code runs flawlessly in my IDE, the ...
0
votes
1
answer
91
views
Unable to fetch the data using column name from pandas dataframe after assigning a column name
I have created a pandas dataframe from an API endpoint. I have used the following to convert to a df.
df = pd.json_normalize(js.loads(js.dumps(key_value))
This however does create df as required but ...
0
votes
0
answers
27
views
Testing for NoneType in Python [duplicate]
I am calling a Monday.com board using their API and attempting to parse the returned JSON. I'm trying to check the value of a column in an item (row if you think of Monday as a table). My query works, ...
0
votes
1
answer
49
views
odoo 16 ir.actions.server AttributeError NoneType
I want to create an ir.actions.server action to open a form with a new record after login. For testing purposes I coded a function in my class
class kskassenbuch(models.Model):
_name = 'ks_sale....
0
votes
1
answer
68
views
Fb Prophet Model Plot : NoneType object is not subscriptable
I am not able to plot anything in Prophet model when I use the commands such as:
plot1 = m.plot(forecast)
plt2 = m.plot_components(forecast)
I am getting error
NoneType object is not subscriptable
0
votes
0
answers
20
views
Python: Can I get None's attribute from the descriptor's __get__?
I have this callable object bool_getter := vars(type(None))["__bool__"].__get__ (of type types.MethodWrapperType). Is there a way to make this bool_getter return None's method None.__bool__ ...
1
vote
1
answer
63
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', ...
0
votes
1
answer
521
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 ...
2
votes
1
answer
76
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 ...
0
votes
0
answers
30
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(...
0
votes
1
answer
101
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)
...
-2
votes
1
answer
166
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?
...
2
votes
2
answers
75
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 ...
0
votes
2
answers
711
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 ...
2
votes
1
answer
337
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 ...
1
vote
0
answers
311
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 ...
0
votes
1
answer
690
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 = ...
0
votes
1
answer
38
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 ...
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, ...
0
votes
2
answers
16
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, ...
0
votes
1
answer
44
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 ...
0
votes
0
answers
69
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
@...
-1
votes
1
answer
41
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 ...
0
votes
1
answer
22
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: '...
0
votes
1
answer
695
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....
20
votes
1
answer
46k
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: ...
0
votes
1
answer
351
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 ...
0
votes
1
answer
32
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&...
0
votes
1
answer
28
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 ...
0
votes
4
answers
100
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 ...
0
votes
1
answer
12
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, '...
0
votes
0
answers
71
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 ...
0
votes
1
answer
39
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 ...
-1
votes
1
answer
51
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
...
0
votes
0
answers
70
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, # ...