PyCharm - 无法保存设置 - 无法保存设置。请重新启动 PyCharm 社区版

2022-09-03 15:36:26

PyCharm在我保存时正在改变这个例外。

WARN - mponents.impl.stores.StoreUtil - Save settings failed
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
    at java.lang.String.charAt(String.java:658)
    at com.intellij.configurationStore.ApplicationStorageManager.expandMacros(ApplicationStoreImpl.kt:108)
    at com.intellij.configurationStore.StateStorageManagerImpl.createStateStorage(StateStorageManagerImpl.kt:194)
    at com.intellij.configurationStore.StateStorageManagerImpl.getOrCreateStorage(StateStorageManagerImpl.kt:150)
    at com.intellij.configurationStore.StateStorageManagerImpl.getStateStorage(StateStorageManagerImpl.kt:133)
    at com.intellij.configurationStore.StateStorageManagerImpl$startExternalization$1.setState(StateStorageManagerImpl.kt:342)
    at com.intellij.configurationStore.ComponentStoreImpl.commitComponent(ComponentStoreImpl.kt:199)
    at com.intellij.configurationStore.ComponentStoreImpl.save(ComponentStoreImpl.kt:124)
    at com.intellij.openapi.components.impl.stores.StoreUtil.save(StoreUtil.java:49)
    at com.intellij.openapi.application.impl.ApplicationImpl.saveSettings(ApplicationImpl.java:1433)
    at com.intellij.ide.SaveAndSyncHandlerImpl.doSaveDocumentsAndProjectsAndApp(SaveAndSyncHandlerImpl.java:150)
    at com.intellij.ide.SaveAndSyncHandlerImpl.saveProjectsAndDocuments(SaveAndSyncHandlerImpl.java:134)
    at com.intellij.ide.SaveAndSyncHandlerImpl$4.onFrameDeactivated(SaveAndSyncHandlerImpl.java:104)
    at com.intellij.ide.FrameStateManagerImpl.fireDeactivationEvent(FrameStateManagerImpl.java:87)
    at com.intellij.ide.FrameStateManagerImpl.access$500(FrameStateManagerImpl.java:32)
    at com.intellij.ide.FrameStateManagerImpl$2$1.run(FrameStateManagerImpl.java:72)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:337)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:321)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:866)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:654)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:381)
    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)

并给我这个错误消息。

enter image description here

我不认为这是文件权限或类似问题,但我真的不确定。.idea

我在堆栈跟踪中收到一些其他错误和警告,但是当我尝试保存项目时,这是重复出现的错误和警告。

当我像这样用sudo运行PyCharm CE时,这个问题仍然存在sudo -u [username] /Applications/PyCharm\ CE.app/Contents/MacOS/pycharm

有人有什么想法吗?

OS: MacOS El Capitan Pycharm: PyCharm Community Edition 5.0.5 JRE: 1.8.0_76-release-b162 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.


答案 1

确保您以管理员身份运行“Pycharm.exe”。

“以管理员身份运行”为所有用户解决了 Windows 操作系统中的此问题。


答案 2

我在放置在 Google 云端硬盘同步文件夹中的项目上收到错误。我关闭了Google云端硬盘,问题就消失了。问题出在 .ideas 文件夹上。