Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Handling Python Fatal Error
#1
Hello,

I have been trying to handle errors in my python code using try & except, but this is not able to handle refcount error which causes my application to crash.

The error I get is:

Fatal Python error: deallocating None

Current thread 0x00007f93428bb700 (most recent call first):
<Stack Trace which is not helping>


How can I handle this kind of error? Or how to identify the root cause for this?

Any help will be appreciated. Thanks.
Larz60+ write Feb-10-2021, 06:29 PM:
Duplicate posts are against forum rules. Please post only one thread, and add posts to that thread if related
Reply
#2
Please show an actual python traceback (error message)
unaltered and complete, within bbcode error tags
Gribouillis likes this post
Reply
#3
(Feb-10-2021, 06:25 PM)Larz60+ Wrote: Please show an actual python traceback (error message)
unaltered and complete, within bbcode error tags

Here is the complete error:

Error:
Fatal Python error: deallocating None Current thread 0x00007f22d5148700 (most recent call first): Thread 0x00007f27115dab80 (most recent call first): File "/usr/lib/python3/dist-packages/gi/overrides/GLib.py", line 585 in run File "myapp.py", line 271 in glib_mainloop File "myapp.py", line 244 in main File "myapp.py", line 302 in <module>
Reply
#4
This error message still looks incomplete as there is no link back to your code (no traceback) which is what I was looking for.
So unfortunately it doesn't help much.
was there a part of the message not included?
Reply
#5
(Feb-11-2021, 09:55 AM)Larz60+ Wrote: This error message still looks incomplete as there is no link back to your code (no traceback) which is what I was looking for.
So unfortunately it doesn't help much.
was there a part of the message not included?

This is all I get in the error. myapp.py is my application python source.
Reply
#6
Can't say without seeing code.
Reply
#7
Looks like an error in the glib wrapper. Without knowing what you're doing, we'd just be making guesses.
Reply
#8
Sorry for reviving an old thread. I just figured out what this error means after many hours of digging, and it frustrates me that I couldn't find good documentation on the error itself. This seems like a very easy mistake to make.

None is a special, global object. What "deallocating None" means is that the reference count on "None" has reached 0, and None is to be deallocated (AKA deleted). This is a bad thing! It likely means that a Python library written in C/C++ is returning Py_None for use in Python proper without first calling Py_INCREF(Py_None). The error then shows itself elsewhere in code because the ref count on None is now 1 too few. When someone throws away its reference to None, only then will this error present itself. It may or may not be a problem in GLib.py if this is the case.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Star python exception handling handling .... with traceback mg24 3 1,215 Nov-09-2022, 07:29 PM
Last Post: Gribouillis
  Help needed with a "for loop" + error handling tamiri 2 2,383 May-27-2022, 12:21 PM
Last Post: tamiri
  Handling pdf files with python. fuzzin 1 1,217 Jan-19-2022, 02:24 PM
Last Post: ThiefOfTime
  Handling multi-input/output audio in python bor1904 4 3,494 Nov-04-2020, 08:25 AM
Last Post: CHLOVRL
  Fatal error after trying to play sound. giladal 0 1,896 Oct-22-2020, 10:27 AM
Last Post: giladal
  Error Handling JarredAwesome 5 2,842 Oct-17-2020, 12:41 AM
Last Post: JarredAwesome
  Python Requests package: Handling xml response soumyarani 1 2,101 Sep-14-2020, 11:41 AM
Last Post: buran
  Fatal python error, need help ryanmagid 0 2,333 Aug-09-2020, 05:51 PM
Last Post: ryanmagid
  Handling Multiple USB ports in Python samalpramod 0 4,359 Aug-01-2020, 07:40 PM
Last Post: samalpramod
  Error handling using cmd module leifeng 3 2,798 Jun-06-2020, 06:25 PM
Last Post: leifeng

Forum Jump:

User Panel Messages

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