If this template helps then use it. If not then just delete and start from scratch.
macOS Mojave 10.14.16
PsychoPy 2020.2.10
The same problem occurs every time I start to type an answer using TextBox. I tried to delete PsychoPy and start again, but this didn’t help.
`Exception ignored in: <bound method TextStim.__del__ of <psychopy.visual.text.TextStim object at 0x1585e65f8>>
Traceback (most recent call last):
File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/visual/text.py", line 240, in __del__
File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/pyglet/gl/lib.py", line 99, in errcheck
ImportError: sys.meta_path is None, Python is likely shutting down
I also use a levenshtein function, but coder says that there’s a syntax error, but I believe that the code is alright:
def levenshtein_ratio_and_distance(s, t, ratio_calc = False):
rows = len(s)+1
cols = len(t)+1
distance = np.zeros((rows,cols),dtype = int)
for i in range(1, rows):
for k in range(1,cols):
distance[i][0] = i
distance[0][k] = k
for col in range(1, cols):
for row in range(1, rows):
if s[row-1] == t[col-1]:
cost = 0 # If the characters are the same in the two strings in a given position [i,j] then the cost is 0
else:
if ratio_calc == True:
cost = 2
else:
cost = 1
distance[row][col] = min(distance[row-1][col] + 1, distance[row][col-1] + 1, distance[row-1][col-1] + cost) # Cost of substitutions
if ratio_calc == True:
Ratio = ((len(s)+len(t)) - distance[row][col]) / (len(s)+len(t))
return Ratio
else:
return distance[row][col]
How can I possibly solve it? The error shows up every time (whether I’m typing or not).