Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSWindow drag regions should only be invalidated on the Main Thread! #2

Open
danbjoseph opened this issue Apr 12, 2024 · 1 comment

Comments

@danbjoseph
Copy link

this project would be a big help for our programs! we hadn't found this previously and we are in the early stages of a similar project - https://github.com/AmericanRedCross/street-view-green-view/

i've been trying to test it out and run into the following error. i'm using macOS 13.4.1 with Apple M2 Pro chip.

$ python main_script.py "Washington, DC, USA" 100 0 "MLY|7639487212737227|db77e7429942d57789f282110986137b" myTestFile 4 4 0 10

Downloading images:   0%|                                               | 0/10 [00:00<?, ?it/s]/Users/danbjoseph/GitHub/Spatial-Data-Science-and-GEO-AI-Lab/StreetView-NatureVisibility/modules/segmentation_images.py:29: UserWarning: Starting a Matplotlib GUI outside of the main thread will likely fail.
  fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2, figsize=(9, 4), sharey=True)
2024-04-12 15:15:39.578 python[75826:30920369] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001a937f154 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x00000001a8e9e4d4 objc_exception_throw + 60
	2   CoreFoundation                      0x00000001a93a83a0 _CFBundleGetValueForInfoKey + 0
	3   AppKit                              0x00000001ac548a00 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 320
	4   AppKit                              0x00000001ac536cd4 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 816
	5   AppKit                              0x00000001ac536998 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 48
	6   _macosx.cpython-310-darwin.so       0x000000017024c9d8 -[Window initWithContentRect:styleMask:backing:defer:withManager:] + 52
	7   _macosx.cpython-310-darwin.so       0x000000017024fc14 FigureManager_init + 224
	8   python3.10                          0x00000001000db49c wrap_init + 20
	9   python3.10                          0x000000010006ef7c wrapperdescr_call + 440
	10  python3.10                          0x000000010006359c _PyObject_MakeTpCall + 612
	11  python3.10                          0x00000001001555d8 call_function + 676
	12  python3.10                          0x0000000100150e60 _PyEval_EvalFrameDefault + 24940
	13  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	14  python3.10                          0x0000000100063850 _PyObject_FastCallDictTstate + 320
	15  python3.10                          0x0000000100064454 _PyObject_Call_Prepend + 176
	16  python3.10                          0x00000001000db394 slot_tp_init + 116
	17  python3.10                          0x00000001000d3d64 type_call + 456
	18  python3.10                          0x000000010006359c _PyObject_MakeTpCall + 612
	19  python3.10                          0x00000001001555d8 call_function + 676
	20  python3.10                          0x00000001001513bc _PyEval_EvalFrameDefault + 26312
	21  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	22  python3.10                          0x0000000100066c64 method_vectorcall + 172
	23  python3.10                          0x0000000100155540 call_function + 524
	24  python3.10                          0x0000000100150e60 _PyEval_EvalFrameDefault + 24940
	25  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	26  python3.10                          0x0000000100066c64 method_vectorcall + 172
	27  python3.10                          0x0000000100155540 call_function + 524
	28  python3.10                          0x0000000100150e60 _PyEval_EvalFrameDefault + 24940
	29  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	30  python3.10                          0x0000000100066c64 method_vectorcall + 172
	31  python3.10                          0x0000000100155540 call_function + 524
	32  python3.10                          0x0000000100150e60 _PyEval_EvalFrameDefault + 24940
	33  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	34  python3.10                          0x0000000100066c64 method_vectorcall + 172
	35  python3.10                          0x0000000100063de0 PyVectorcall_Call + 156
	36  python3.10                          0x0000000100151658 _PyEval_EvalFrameDefault + 26980
	37  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	38  python3.10                          0x0000000100063de0 PyVectorcall_Call + 156
	39  python3.10                          0x0000000100151658 _PyEval_EvalFrameDefault + 26980
	40  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	41  python3.10                          0x0000000100063de0 PyVectorcall_Call + 156
	42  python3.10                          0x0000000100151658 _PyEval_EvalFrameDefault + 26980
	43  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	44  python3.10                          0x0000000100063de0 PyVectorcall_Call + 156
	45  python3.10                          0x0000000100151658 _PyEval_EvalFrameDefault + 26980
	46  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	47  python3.10                          0x0000000100155540 call_function + 524
	48  python3.10                          0x0000000100151430 _PyEval_EvalFrameDefault + 26428
	49  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	50  python3.10                          0x0000000100155540 call_function + 524
	51  python3.10                          0x00000001001513bc _PyEval_EvalFrameDefault + 26312
	52  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	53  python3.10                          0x0000000100155540 call_function + 524
	54  python3.10                          0x00000001001513bc _PyEval_EvalFrameDefault + 26312
	55  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	56  python3.10                          0x0000000100151658 _PyEval_EvalFrameDefault + 26980
	57  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	58  python3.10                          0x0000000100155540 call_function + 524
	59  python3.10                          0x0000000100150e38 _PyEval_EvalFrameDefault + 24900
	60  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	61  python3.10                          0x0000000100151658 _PyEval_EvalFrameDefault + 26980
	62  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	63  python3.10                          0x0000000100155540 call_function + 524
	64  python3.10                          0x0000000100150e38 _PyEval_EvalFrameDefault + 24900
	65  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	66  python3.10                          0x0000000100155540 call_function + 524
	67  python3.10                          0x0000000100150e38 _PyEval_EvalFrameDefault + 24900
	68  python3.10                          0x000000010014a364 _PyEval_Vector + 2036
	69  python3.10                          0x0000000100066d10 method_vectorcall + 344
	70  python3.10                          0x000000010021c830 thread_run + 180
	71  python3.10                          0x00000001001b8230 pythread_wrapper + 48
	72  libsystem_pthread.dylib             0x00000001a9227fa8 _pthread_start + 148
	73  libsystem_pthread.dylib             0x00000001a9222da0 thread_start + 8
)
libc++abi: terminating due to uncaught exception of type NSException
[1]    75826 abort      python main_script.py "Washington, DC, USA" 100 0  myTestFile 4 4 0 10
/opt/homebrew/Caskroom/miniforge/base/envs/.venv/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
@danbjoseph
Copy link
Author

i got past this error by adding the following to segmentation_images.py

import matplotlib as matplotlib
matplotlib.use('agg')

based on looking at matplotlib/matplotlib#14304 and https://matplotlib.org/stable/users/explain/figure/backends.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant