Issue
Whenever I try to run the program in a ipython cell it gives me a weird error.
test_pts = sorted_points
new_segments = []
import pdb; pdb.set_trace()
for i in range(0, len(test_pts)-1):
x1 = test_pts[i][0]; y1 = test_pts[i][1]; x2 = test_pts[i][2]; y2 = test_pts[i][3]; angle1 = test_pts[i][4]
print(x1, y1, x2, y2, angle1)
for j in range(i + 1, len(test_pts)):
n_x1 = test_pts[j][0]; n_y1 = test_pts[j][1]; n_x2 = test_pts[j][2]; n_y2 = test_pts[j][3]; angle2 = test_pts[j][4]
if (isclose(angle1, angle2, rel_tol = 1)) and (isclose(x1, x2, rel_tol = 1) and (isclose(y1, y1, rel_tol = 1))):
print(n_x1, n_y1, n_x2, n_y2, angle2)
break
The stack trace below -> I feel like this problem is not reproducible, and it is not even code-specific, i.e there is nothing wrong with the code I have written, but I'm unable to figure out what is causing this behaviour.
# %% LINE EXTENSION - CONNECT...
--Return--
None
> (3)()
1 test_pts = sorted_points
2 new_segments = []
----> 3 import pdb; pdb.set_trace()
4 for i in range(0, len(test_pts)-1):
5 x1 = test_pts[i][0]; y1 = test_pts[i][1]; x2 = test_pts[i][2]; y2 = test_pts[i][3]; angle1 = test_pts[i][4]
[... skipped 1 hidden frame]
> /home/and/CERLAB/lib/python3.8/site-packages/IPython/core/interactiveshell.py(3346)run_code()
3344 finally:
3345 # Reset our crash handler in place
-> 3346 sys.excepthook = old_excepthook
3347 except SystemExit as e:
3348 if result is not None:
Solution
I am still not sure what the problem exactly is - this isn't something that happens in a normal python file, seems to only happen in .ipnyb files.
The breakpoints put in this manner only work if they are inside a function, otherwise they don't work. So basically if you are running into this problem, then make sure that the statement is inside a function.
Answered By - PyWalker2797
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.