I am calling Numpy in my subroutine:
import numpy as np
def IsUnderLine(xarray, yarray, TestPoint):
a = np.array([0, 50])
b = np.array([0, 193.53])
coefficients = np.polyfit(a, b, 1)
coefficients = np.polyfit(xarray, yarray, 1)
# calculate the Y of the point which should be on the line
YOnLine = TestPoint[0] * coefficients[0] + coefficients[1]
# Check if our real Y is over or under the line -> which way is the circle?
if (TestPoint[1] > YOnLine):
return True
else:
return False
bb = IsUnderLine([1,2], [3,4], [3,5])
print(bb)
If I call ‘IsUnderLine’ from the test code in the same file, it works fine. But when I call the function from an outside routine, it fails without explanation at the first test assignemtn to the variable a. The call to the routine is:
if (IsUnderLine([p1, p3], [z1, z3], [p2, z2])):
and all the values in the arrays are float.
The error I get is:
File "C:Usersrainer.barsPycharmProjectsmapcirclesIsUnderLine.py", line 8, in IsUnderLine
a = np.array([0, 50])
^^
File "_pydevd_bundle\pydevd_pep_669_tracing_cython.pyx", line 460, in _pydevd_bundle.pydevd_pep_669_tracing_cython.PyLineCallback.__call__
File "_pydevd_bundle\pydevd_pep_669_tracing_cython.pyx", line 452, in _pydevd_bundle.pydevd_pep_669_tracing_cython.PyLineCallback.__call__
AttributeError: 'PyLineCallback' object has no attribute 'py_db'
Process finished with exit code -1073741819 (0xC0000005)
What is the problem, why do I get an error in one case but not the other? And how do I fix the error?