Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python nonetype variable
#1
hello I have the following in a threaded function executes several at the same time
profit is global variable

profit += result
profit = round (profit, 2)

and there is no way to get it when you run 2 simultaneous error

python TypeError: unsupported operand type (s) for +: 'int' and 'NoneType'

what can I do

if profit is None:

profit = 0

did not solve my problem, the profit variable is profit = 0 before the function and does not work if it is not simultaneous, only 2 theads calling the function there of the error
Reply


Messages In This Thread
python nonetype variable - by fabiodurgante - Nov-12-2020, 12:29 AM
RE: python nonetype variable - by Larz60+ - Nov-12-2020, 01:35 AM
RE: python nonetype variable - by fabiodurgante - Nov-12-2020, 06:23 PM
RE: python nonetype variable - by Larz60+ - Nov-13-2020, 01:06 AM
RE: python nonetype variable - by bowlofred - Nov-13-2020, 03:27 AM
RE: python nonetype variable - by Larz60+ - Nov-13-2020, 04:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python: Regex is not good for re.search (AttributeError: 'NoneType' object has no att Melcu54 9 3,567 Jun-28-2023, 11:13 AM
Last Post: Melcu54

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020