pycharm的插件pylint报错:java.lang.Throwable: Write-unsafe context! Model changes are allowed from write-safe contexts only. Please ensure you're using invokeLater/invokeAndWait with a correct modality stat

时间:2024-01-08 08:32:02

java.lang.Throwable: Write-unsafe context! Model changes are allowed from write-safe contexts only. Please ensure you're using invokeLater/invokeAndWait with a correct modality state (not "any"). See TransactionGuard documentation for details.
  current modality=ModalityState.NON_MODAL
  known modalities:
    ModalityState.NON_MODAL, writingAllowed=true;
    ModalityState:{}, writingAllowed=true;
    ModalityState:{[com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog[dialog12,1874,-117,631x767,invalid,hidden,layout=java.awt.BorderLayout,APPLICATION_MODAL,title=Push Commits,defaultCloseOperation=DO_NOTHING_ON_CLOSE,rootPane=,rootPaneCheckingEnabled=true]]}, writingAllowed=true;
    ModalityState:{}, writingAllowed=true;
    ModalityState:{}, writingAllowed=true;
    ModalityState:{[com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog[dialog33,2083,205,633x213,invalid,hidden,layout=java.awt.BorderLayout,APPLICATION_MODAL,title=Move,defaultCloseOperation=DO_NOTHING_ON_CLOSE,rootPane=,rootPaneCheckingEnabled=true]]}, writingAllowed=true;
    ModalityState:{}, writingAllowed=true;
    ModalityState:{}, writingAllowed=true;
    ModalityState:{}, writingAllowed=true;
    ModalityState:{}, writingAllowed=true;
    ModalityState:{[com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog[dialog23,2083,205,633x213,invalid,hidden,layout=java.awt.BorderLayout,APPLICATION_MODAL,title=Move,defaultCloseOperation=DO_NOTHING_ON_CLOSE,rootPane=,rootPaneCheckingEnabled=true]]}, writingAllowed=true;
    ModalityState:{}, writingAllowed=true;
    ModalityState:{}, writingAllowed=true
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:123)
    at com.intellij.openapi.application.TransactionGuardImpl.assertWriteActionAllowed(TransactionGuardImpl.java:232)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.a(FileEditorManagerImpl.java:844)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:652)
    at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:665)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl4(FileEditorManagerImpl.java:960)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl3(FileEditorManagerImpl.java:782)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.a(FileEditorManagerImpl.java:764)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.a(CoreCommandProcessor.java:139)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:97)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:87)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:73)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl2(FileEditorManagerImpl.java:764)
    at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileWithProviders(FileEditorManagerImpl.java:695)
    at com.intellij.openapi.fileEditor.ex.FileEditorManagerEx.openFile(FileEditorManagerEx.java:139)
    at com.leinardi.pycharm.pylint.toolwindow.PylintToolWindowPanel.scrollToError(PylintToolWindowPanel.java:315)
    at com.leinardi.pycharm.pylint.toolwindow.PylintToolWindowPanel.access$200(PylintToolWindowPanel.java:77)
    at com.leinardi.pycharm.pylint.toolwindow.PylintToolWindowPanel$ToolWindowSelectionListener.valueChanged(PylintToolWindowPanel.java:406)
    at javax.swing.JTree.fireValueChanged(JTree.java:2927)
    at javax.swing.JTree$TreeSelectionRedirector.valueChanged(JTree.java:3391)
    at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(DefaultTreeSelectionModel.java:635)
    at com.intellij.ui.treeStructure.Tree$MySelectionModel.fireValueChanged(Tree.java:672)
    at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(DefaultTreeSelectionModel.java:1093)
    at javax.swing.tree.DefaultTreeSelectionModel.removeSelectionPaths(DefaultTreeSelectionModel.java:502)
    at javax.swing.JTree.removeDescendantSelectedPaths(JTree.java:3723)
    at javax.swing.JTree$TreeModelHandler.treeStructureChanged(JTree.java:3828)
    at javax.swing.tree.DefaultTreeModel.fireTreeStructureChanged(DefaultTreeModel.java:580)
    at javax.swing.tree.DefaultTreeModel.nodeStructureChanged(DefaultTreeModel.java:365)
    at com.leinardi.pycharm.pylint.toolwindow.ResultTreeModel.clear(ResultTreeModel.java:56)
    at com.leinardi.pycharm.pylint.toolwindow.PylintToolWindowPanel.displayInProgress(PylintToolWindowPanel.java:471)
    at com.leinardi.pycharm.pylint.checker.UiFeedbackScannerListener.lambda$scanStarting$0(UiFeedbackScannerListener.java:41)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
    at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:781)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:722)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

可能的解决办法是,修改pylint的设置,不要实时扫描所有的目录,因为有些目录“Scratches and Consoles”,估计插件没有写权限

pycharm的插件pylint报错:java.lang.Throwable: Write-unsafe context! Model changes are allowed from write-safe contexts only. Please ensure you're using invokeLater/invokeAndWait with a correct modality stat