Thanks to visit codestin.com
Credit goes to github.com

Skip to content

'NSWindow drag regions should only be invalidated on the Main Thread!' - macos/python #14304

Closed
@Hashmanity

Description

@Hashmanity

Bug summary

I have currently written a python script (call it detect.py) that checks to see if a new file has been added to a directory. If so, it calls another Python script (call it program.py) that takes the new file as input and uses matplotlib to plot graphs. However, instead of plotting and saving images, I get the resulting output:

Python[30970:2506101] *** 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 0x00007fff4a758cf9 __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff752eda17 objc_exception_throw + 48
2 CoreFoundation 0x00007fff4a772859 -[NSException raise] + 9
3 AppKit 0x00007fff47da8e26 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 317
4 AppKit 0x00007fff47da6253 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1479
5 AppKit 0x00007fff47da5c86 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45
6 _macosx.so 0x000000011640f200 -[Window initWithContentRect:styleMask:backing:defer:withManager:] + 80
7 _macosx.so 0x0000000116412747 FigureManager_init + 327
8 Python 0x000000010c5b1468 wrap_init + 12
9 Python 0x000000010c56acf5 PyObject_Call + 97
10 Python 0x000000010c5eabe8 PyEval_CallObjectWithKeywords + 159
11 Python 0x000000010c57afab wrapperdescr_call + 127
12 Python 0x000000010c56acf5 PyObject_Call + 97
.
.
.
61 Python 0x000000010c612aee pythread_wrapper + 25
62 libsystem_pthread.dylib 0x00007fff76d092eb _pthread_body + 126
63 libsystem_pthread.dylib 0x00007fff76d0c249 _pthread_start + 66
64 libsystem_pthread.dylib 0x00007fff76d0840d thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6


From what I understand, Matplotlib is explicitly prone to multi-threading errors. Does this mean I cannot create an automated script for detecting new files and running a matplotlib analysis on the new files? O

Here is some additional information that I hope helps:

  • Operating system: Mac OS Mojave (10.14.4)
  • Matplotlib version: 2.2.4 (installed from pip)
  • Python version: 2.7.16
  • For automatic file detection, I used the watchdog library for python.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions