1 year ago
#344206
user93807
Error: ...returned a result with an exception set
I was trying to copy an Object, which included a numpy array (which included other Objects(type "Feld")), with copy.deepcopy() and got this error: SystemError: <built-in method deepcopy of numpy.ndarray object at 0x0000014EFFF0FA50> returned a result with an exception set. Can anyone tell me, what I am doing wrong? I searched the whole internet and did not find an answer..
my try to copy an Object
for i in range(0, 1040, 130):
for j in range(0, 1040, 130):
board.felder[int(i/130)][int(j/130)] = Feld(i+65, j+65)
board2 = copy.deepcopy(board)
class Feld
image = pygame.image.load("Images/MissingNo.png")
empty = Figure(image)
class Feld():
def __init__(self, x, y, figure=empty, besetzt=False) -> None:
self.x = x
self.y = y
self.figure = figure
self.besetzt = besetzt
def reset(self):
self.figure = empty
self.besetzt = False
def set(self, figure):
self.besetzt = True
self.figure = figure
innit of class board
def __init__(self, player) -> None:
self.turn = 0
self.player = player
self.moves = []
self.my_move = []
self.felder = np.empty((8, 8), dtype=Feld)
self.schach = -1
and this is the error message (the full error is more than 100 lines)
... The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "C:\Users\Nutzer\AppData\Local\Programs\Python\Python310\lib\copy.py", line 137, in deepcopy d = id(x) SystemError: returned a result with an exception set
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "C:\Users\Nutzer\AppData\Local\Programs\Python\Python310\lib\copy.py", line 137, in deepcopy d = id(x) SystemError: returned a result with an exception set
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "c:\Users\Nutzer\Videos\Change\ML\PY\Produkt copy\main.py", line 56, in
board2 = copy.deepcopy(board) File "C:\Users\Nutzer\AppData\Local\Programs\Python\Python310\lib\copy.py", line 172, in deepcopy y = _reconstruct(x, memo, *rv) File "C:\Users\Nutzer\AppData\Local\Programs\Python\Python310\lib\copy.py", line 271, in _reconstruct state = deepcopy(state, memo) File "C:\Users\Nutzer\AppData\Local\Programs\Python\Python310\lib\copy.py", line 146, in deepcopy y = copier(x, memo) File "C:\Users\Nutzer\AppData\Local\Programs\Python\Python310\lib\copy.py", line 231, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "C:\Users\Nutzer\AppData\Local\Programs\Python\Python310\lib\copy.py", line 153, in deepcopy y = copier(memo) SystemError: <built-in method deepcopy of numpy.ndarray object at 0x000001DC183C0510> returned a result with an exception set
python
arrays
numpy-ndarray
system-error
0 Answers
Your Answer