Python Forum
ReferenceError: weakly-referenced object no longer exists
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ReferenceError: weakly-referenced object no longer exists
#18
if you look at the mysql.connector source code you will see it uses weakref
class CMySQLCursor(MySQLCursorAbstract):

    """Default cursor for interacting with MySQL using C Extension"""

    _raw = False
    _buffered = False
    _raw_as_string = False

    def __init__(self, connection):
        """Initialize"""
        MySQLCursorAbstract.__init__(self)

        self._insert_id = 0
        self._warning_count = 0
        self._warnings = None
        self._affected_rows = -1
        self._rowcount = -1
        self._nextrow = (None, None)
        self._executed = None
        self._executed_list = []
        self._stored_results = []

        if not isinstance(connection, MySQLConnectionAbstract):
            raise errors.InterfaceError(errno=2048)
        self._cnx = weakref.proxy(connection)
So, actually the weakly referenced object is connection and it is destroyed, which leads to error in execute(), line 232

        if not self._cnx:
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE: ReferenceError: weakly-referenced object no longer exists - by buran - Dec-14-2020, 07:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Beginner: Code not work when longer list raiviscoding 2 838 May-19-2023, 11:19 AM
Last Post: deanhystad
  local varible referenced before assignment SC4R 6 1,535 Jan-10-2023, 10:58 PM
Last Post: snippsat
  a longer docstring Skaperen 8 1,697 Aug-25-2022, 11:21 PM
Last Post: Skaperen
  UnboundLocalError: local variable 'wmi' referenced before assignment ilknurg 2 1,926 Feb-10-2022, 07:36 PM
Last Post: deanhystad
  Referenced before assignment finndude 3 3,301 Mar-02-2021, 08:11 PM
Last Post: finndude
  IDLE editing window no longer works chris1 2 2,237 Feb-06-2021, 07:59 AM
Last Post: chris1
  Code no longer working yk303 14 10,257 Dec-21-2020, 10:58 PM
Last Post: bowlofred
  UnboundLocalError: local variable 'figure_perso' referenced before assignment mederic39 2 2,285 Jun-11-2020, 12:45 PM
Last Post: Yoriz
  p]Why os.path.exists("abc/d") and os.path.exists("abc/D") treat same rajeev1729 1 2,182 May-27-2020, 08:34 AM
Last Post: DeaD_EyE
  local variable 'marks' referenced before assignment Calli 3 2,348 May-25-2020, 03:15 PM
Last Post: Calli

Forum Jump:

User Panel Messages

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