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

Corrupt autosave files don't get reset #11375

Closed
hmaarrfk opened this issue Jan 21, 2020 · 20 comments · Fixed by #11608
Closed

Corrupt autosave files don't get reset #11375

hmaarrfk opened this issue Jan 21, 2020 · 20 comments · Fixed by #11608

Comments

@hmaarrfk
Copy link

10:28 $ spyder --debug-output terminal --debug-info verbose
Attribute Qt::AA_UseSoftwareOpenGL must be set before QCoreApplication is created.
2020-01-21 10:28:19,996 [INFO] [spyder.app.mainwindow] -> Start of MainWindow constructor
2020-01-21 10:28:20,019 [INFO] [spyder.app.mainwindow] -> End of MainWindow constructor
2020-01-21 10:28:20,019 [INFO] [spyder.app.mainwindow] -> *** Start of MainWindow setup ***
2020-01-21 10:28:20,019 [INFO] [spyder.app.mainwindow] -> Updating PYTHONPATH
2020-01-21 10:28:20,019 [INFO] [spyder.app.mainwindow] -> Applying theme configuration...
2020-01-21 10:28:20,019 [INFO] [qdarkstyle] -> Found QT_API='pyqt5'
2020-01-21 10:28:20,020 [INFO] [qdarkstyle] -> Using Qt wrapper = PyQt5 
2020-01-21 10:28:20,027 [INFO] [spyder.app.mainwindow] -> Creating core actions...
2020-01-21 10:28:20,028 [INFO] [spyder.app.mainwindow] -> Creating toolbars...
2020-01-21 10:28:20,034 [INFO] [spyder.app.mainwindow] -> Creating Tools menu...
2020-01-21 10:28:20,037 [INFO] [spyder.app.mainwindow] -> Creating guidata and sift entries...
2020-01-21 10:28:20,038 [INFO] [spyder.app.mainwindow] -> Loading switcher...
2020-01-21 10:28:20,041 [INFO] [spyder.app.mainwindow] -> Loading internal console...
2020-01-21 10:28:20,080 [INFO] [keyring.backend] -> Loading KWallet
2020-01-21 10:28:20,080 [INFO] [keyring.backend] -> Loading SecretService
2020-01-21 10:28:20,087 [INFO] [keyring.backend] -> Loading Windows
2020-01-21 10:28:20,087 [INFO] [keyring.backend] -> Loading chainer
2020-01-21 10:28:20,087 [INFO] [keyring.backend] -> Loading macOS
2020-01-21 10:28:20,106 [INFO] [spyder.plugins.console.plugin] -> Initializing...
2020-01-21 10:28:20,148 [INFO] [spyder.app.mainwindow] -> Starting code completion manager...
2020-01-21 10:28:20,223 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Registering lsp
2020-01-21 10:28:20,249 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Registering kite
2020-01-21 10:28:20,250 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Registering fallback
2020-01-21 10:28:20,250 [INFO] [spyder.app.mainwindow] -> Loading working directory...
2020-01-21 10:28:20,250 [DEBUG] [spyder.plugins.completion.fallback.actor] -> Fallback plugin starting...
2020-01-21 10:28:20,277 [INFO] [spyder.app.mainwindow] -> Loading help...
2020-01-21 10:28:20,284 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel EdgeLine at floating
2020-01-21 10:28:20,284 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,285 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel EdgeLine installed
2020-01-21 10:28:20,285 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel IndentationGuide at floating
2020-01-21 10:28:20,285 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,285 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel IndentationGuide installed
2020-01-21 10:28:20,285 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel FoldingPanel at left
2020-01-21 10:28:20,285 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,286 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel FoldingPanel installed
2020-01-21 10:28:20,286 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel DebuggerPanel at left
2020-01-21 10:28:20,286 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,287 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel DebuggerPanel installed
2020-01-21 10:28:20,287 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel LineNumberArea at left
2020-01-21 10:28:20,287 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,287 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel LineNumberArea installed
2020-01-21 10:28:20,288 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel ClassFunctionDropdown at top
2020-01-21 10:28:20,288 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,288 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel ClassFunctionDropdown installed
2020-01-21 10:28:20,288 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel ScrollFlagArea at right
2020-01-21 10:28:20,288 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,289 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel ScrollFlagArea installed
2020-01-21 10:28:20,289 [DEBUG] [spyder.api.panel] -> ScrollFlagArea visibility changed
2020-01-21 10:28:20,289 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,289 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,293 [DEBUG] [spyder.plugins.editor.extensions.manager] -> adding extension CloseQuotesExtension
2020-01-21 10:28:20,293 [DEBUG] [spyder.plugins.editor.extensions.manager] -> adding extension SnippetsExtension
2020-01-21 10:28:20,294 [DEBUG] [spyder.plugins.editor.extensions.manager] -> adding extension CloseBracketsExtension
2020-01-21 10:28:20,295 [DEBUG] [spyder.api.panel] -> DebuggerPanel visibility changed
2020-01-21 10:28:20,295 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,295 [DEBUG] [spyder.api.panel] -> FoldingPanel visibility changed
2020-01-21 10:28:20,295 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,295 [DEBUG] [spyder.api.panel] -> ScrollFlagArea visibility changed
2020-01-21 10:28:20,295 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,295 [DEBUG] [spyder.api.panel] -> EdgeLine visibility changed
2020-01-21 10:28:20,295 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,295 [DEBUG] [spyder.api.panel] -> IndentationGuide visibility changed
2020-01-21 10:28:20,295 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,296 [DEBUG] [spyder.api.panel] -> LineNumberArea visibility changed
2020-01-21 10:28:20,296 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,299 [DEBUG] [spyder.api.panel] -> ClassFunctionDropdown visibility changed
2020-01-21 10:28:20,299 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,349 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-01-21 10:28:20,393 [INFO] [spyder.app.mainwindow] -> Loading outline explorer...
2020-01-21 10:28:20,418 [INFO] [spyder.app.mainwindow] -> Loading editor...
2020-01-21 10:28:20,450 [DEBUG] [spyder.plugins.editor.utils.autosave] -> Reading pid file: /home/mark/.config/spyder-py3/autosave/pid6268.txt
The textfile is

Traceback (most recent call last):
  File "/home/mark/miniconda3/envs/mcam_dev/lib/python3.7/site-packages/spyder/app/mainwindow.py", line 3718, in main
    mainwindow = run_spyder(app, options, args)
  File "/home/mark/miniconda3/envs/mcam_dev/lib/python3.7/site-packages/spyder/app/mainwindow.py", line 3559, in run_spyder
    main.setup()
  File "/home/mark/miniconda3/envs/mcam_dev/lib/python3.7/site-packages/spyder/app/mainwindow.py", line 955, in setup
    self.editor = Editor(self)
  File "/home/mark/miniconda3/envs/mcam_dev/lib/python3.7/site-packages/spyder/plugins/editor/plugin.py", line 178, in __init__
    self.autosave.try_recover_from_autosave()
  File "/home/mark/miniconda3/envs/mcam_dev/lib/python3.7/site-packages/spyder/plugins/editor/utils/autosave.py", line 178, in try_recover_from_autosave
    files_to_recover, pidfiles = self.get_files_to_recover()
  File "/home/mark/miniconda3/envs/mcam_dev/lib/python3.7/site-packages/spyder/plugins/editor/utils/autosave.py", line 151, in get_files_to_recover
    txt_as_dict = ast.literal_eval(txt)
  File "/home/mark/miniconda3/envs/mcam_dev/lib/python3.7/ast.py", line 46, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/home/mark/miniconda3/envs/mcam_dev/lib/python3.7/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 0

Using

spyder --reset

didn't work

After manually removing

/home/mark/.config/spyder-py3/autosave/pid6268.txt

Things started to work again.

Versions

$ conda install spyder python=3.7 --yes
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/mark/miniconda3/envs/mcam_dev

  added / updated specs:
    - python=3.7
    - spyder


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _libgcc_mutex-0.1          |      conda_forge           3 KB  conda-forge
    _openmp_mutex-4.5          |            0_gnu         435 KB  conda-forge
    alabaster-0.7.12           |             py_0          15 KB  conda-forge
    argh-0.26.2                |        py37_1001          33 KB  conda-forge
    astroid-2.3.3              |           py37_1         279 KB  conda-forge
    atomicwrites-1.3.0         |             py_0           9 KB  conda-forge
    autopep8-1.5               |             py_0          38 KB  conda-forge
    babel-2.8.0                |             py_0         6.0 MB  conda-forge
    backcall-0.1.0             |             py_0          13 KB  conda-forge
    bleach-3.1.0               |             py_0         110 KB  conda-forge
    cloudpickle-1.2.2          |             py_1          23 KB  conda-forge
    dbus-1.13.6                |       he372182_0         602 KB  conda-forge
    defusedxml-0.6.0           |             py_0          22 KB  conda-forge
    diff-match-patch-20181111  |             py_0          37 KB  conda-forge
    docutils-0.16              |           py37_0         739 KB  conda-forge
    entrypoints-0.3            |        py37_1000          11 KB  conda-forge
    expat-2.2.5                |    he1b5a44_1004         191 KB  conda-forge
    flake8-3.7.9               |           py37_0         128 KB  conda-forge
    fontconfig-2.13.1          |    h86ecdb6_1001         340 KB  conda-forge
    freetype-2.10.0            |       he983fc9_1         884 KB  conda-forge
    future-0.18.2              |           py37_0         711 KB  conda-forge
    gettext-0.19.8.1           |    hc5be6a0_1002         3.6 MB  conda-forge
    glib-2.58.3                |py37h6f030ca_1002         3.3 MB  conda-forge
    gst-plugins-base-1.14.5    |       h0935bb2_0         6.8 MB  conda-forge
    gstreamer-1.14.5           |       h36ae1b5_0         4.5 MB  conda-forge
    icu-64.2                   |       he1b5a44_1        12.6 MB  conda-forge
    imagesize-1.2.0            |             py_0           8 KB  conda-forge
    intervaltree-3.0.2         |             py_0          23 KB  conda-forge
    ipykernel-5.1.3            |   py37h5ca1d4c_0         160 KB  conda-forge
    ipython-7.11.1             |   py37h5ca1d4c_0         1.1 MB  conda-forge
    isort-4.3.21               |           py37_0          64 KB  conda-forge
    jedi-0.14.1                |           py37_0         698 KB  conda-forge
    jeepney-0.4.2              |             py_0          19 KB  conda-forge
    jinja2-2.10.3              |             py_0          91 KB  conda-forge
    jpeg-9c                    |    h14c3975_1001         251 KB  conda-forge
    jupyter_client-5.3.4       |           py37_1         131 KB  conda-forge
    keyring-21.1.0             |           py37_0          46 KB  conda-forge
    lazy-object-proxy-1.4.3    |   py37h516909a_0          27 KB  conda-forge
    libclang-9.0.1             |default_hde54327_0        22.3 MB  conda-forge
    libiconv-1.15              |    h516909a_1005         2.0 MB  conda-forge
    libllvm9-9.0.1             |       hc9558a2_0        25.1 MB  conda-forge
    libpng-1.6.37              |       hed695b0_0         343 KB  conda-forge
    libsodium-1.0.17           |       h516909a_0         330 KB  conda-forge
    libspatialindex-1.9.3      |       he1b5a44_1         3.1 MB  conda-forge
    libuuid-2.32.1             |    h14c3975_1000          26 KB  conda-forge
    libxcb-1.13                |    h14c3975_1002         396 KB  conda-forge
    libxkbcommon-0.9.1         |       hebb1f50_0         472 KB  conda-forge
    libxml2-2.9.10             |       hee79883_0         1.3 MB  conda-forge
    markupsafe-1.1.1           |   py37h516909a_0          26 KB  conda-forge
    mccabe-0.6.1               |             py_1           8 KB  conda-forge
    mistune-0.8.4              |py37h516909a_1000          53 KB  conda-forge
    nbconvert-5.6.1            |           py37_0         487 KB  conda-forge
    nspr-4.24                  |       he1b5a44_0         1.6 MB  conda-forge
    nss-3.47                   |       he751ad9_0         1.9 MB  conda-forge
    numpydoc-0.9.2             |             py_0          29 KB  conda-forge
    packaging-20.0             |             py_0          31 KB  conda-forge
    pandoc-2.9.1.1             |                0        16.6 MB  conda-forge
    pandocfilters-1.4.2        |             py_1           9 KB  conda-forge
    parso-0.5.2                |             py_0          66 KB  conda-forge
    pathtools-0.1.2            |             py_1           8 KB  conda-forge
    pcre-8.43                  |       he1b5a44_0         257 KB  conda-forge
    pexpect-4.7.0              |           py37_0          78 KB  conda-forge
    pickleshare-0.7.5          |        py37_1000          12 KB  conda-forge
    pluggy-0.12.0              |             py_0          18 KB  conda-forge
    prompt_toolkit-3.0.2       |             py_0         226 KB  conda-forge
    psutil-5.6.7               |   py37h516909a_0         323 KB  conda-forge
    pthread-stubs-0.4          |    h14c3975_1001           5 KB  conda-forge
    ptyprocess-0.6.0           |          py_1001          15 KB  conda-forge
    pycodestyle-2.5.0          |             py_0          36 KB  conda-forge
    pydocstyle-5.0.2           |             py_0          32 KB  conda-forge
    pyflakes-2.1.1             |             py_0          49 KB  conda-forge
    pygments-2.5.2             |             py_0         669 KB  conda-forge
    pylint-2.4.4               |           py37_0         424 KB  conda-forge
    pyparsing-2.4.6            |             py_0          59 KB  conda-forge
    pyqt-5.12.3                |   py37hcca6a23_1         6.3 MB  conda-forge
    python-jsonrpc-server-0.3.4|             py_0          11 KB  conda-forge
    python-language-server-0.31.5|           py37_0          66 KB  conda-forge
    pyxdg-0.26                 |             py_0          42 KB  conda-forge
    pyzmq-18.1.1               |   py37h1768529_0         517 KB  conda-forge
    qdarkstyle-2.7             |             py_0         725 KB  conda-forge
    qt-5.12.5                  |       hd8c4c69_1        99.2 MB  conda-forge
    qtawesome-0.6.1            |             py_0         766 KB  conda-forge
    qtconsole-4.6.0            |             py_0          90 KB  conda-forge
    qtpy-1.9.0                 |             py_0          34 KB  conda-forge
    rope-0.16.0                |             py_0         117 KB  conda-forge
    rtree-0.9.3                |   py37h7b0cdae_0          42 KB  conda-forge
    secretstorage-3.1.2        |           py37_0          23 KB  conda-forge
    setuptools-45.1.0          |           py37_0         648 KB  conda-forge
    snowballstemmer-2.0.0      |             py_0          55 KB  conda-forge
    sortedcontainers-2.1.0     |             py_0          25 KB  conda-forge
    sphinx-2.3.1               |             py_0         1.4 MB  conda-forge
    sphinxcontrib-applehelp-1.0.1|             py_0          28 KB  conda-forge
    sphinxcontrib-devhelp-1.0.1|             py_0          22 KB  conda-forge
    sphinxcontrib-htmlhelp-1.0.2|             py_0          27 KB  conda-forge
    sphinxcontrib-jsmath-1.0.1 |             py_0           7 KB  conda-forge
    sphinxcontrib-qthelp-1.0.2 |             py_0          25 KB  conda-forge
    sphinxcontrib-serializinghtml-1.1.3|             py_0          24 KB  conda-forge
    spyder-4.0.1               |           py37_0         7.6 MB  conda-forge
    spyder-kernels-1.8.1       |           py37_0          86 KB  conda-forge
    testpath-0.4.4             |             py_0          85 KB  conda-forge
    tornado-6.0.3              |   py37h516909a_0         637 KB  conda-forge
    typed-ast-1.4.1            |   py37h516909a_0         205 KB  conda-forge
    ujson-1.35                 |py37h516909a_1001          27 KB  conda-forge
    watchdog-0.9.0             |           py37_1          90 KB  conda-forge
    wcwidth-0.1.8              |             py_0          19 KB  conda-forge
    webencodings-0.5.1         |             py_1          12 KB  conda-forge
    wrapt-1.11.2               |   py37h516909a_0          46 KB  conda-forge
    wurlitzer-2.0.0            |           py37_0          12 KB  conda-forge
    xorg-libxau-1.0.9          |       h14c3975_0          13 KB  conda-forge
    xorg-libxdmcp-1.1.3        |       h516909a_0          18 KB  conda-forge
    yapf-0.28.0                |             py_0         116 KB  conda-forge
    zeromq-4.3.2               |       he1b5a44_2         668 KB  conda-forge
    zipp-2.0.0                 |             py_0           7 KB  conda-forge
    ------------------------------------------------------------
                                           Total:       242.0 MB

@goanpeca
Copy link
Member

@jitseniesen could you take a look at this one :-) ?

@dn7
Copy link

dn7 commented Feb 13, 2020

First of all, thank you spyder developers for your work.
A similar thing happened to me twice during the past two days.

I understand that the next update will likely solve the reset function, but maybe there is a way to deal with corrupt autosave files in a smoother way (in terms of user interaction), and without resetting other settings. Perhaps popping up a message saying "Opening autosave files caused an error. Do you want to discard the autosave files and try starting Spyder again? These files will be moved to the recycle bin." Maybe sending the files to the recycle bin would be better than deleting them.

I am adding more info that might help you understand why the autosave files are being corrupted. Sorry if I am providing too much detail, yet if you need more info please let me know.

To begin with, I think that this happened after updating another software: in the first time I updated Firefox from 72.0.2 to 73.0.0, and in the second time, I updated Adobe Reader DC from some recent version to the latest (20.006.20034). I closed Spyder to update adobe (I think I did it for updating Firefox as well, but I might be wrong). This might be a coincidence, though. I closed and opened Spyder on other occasions without a problem, but I cannot say whether I had autosaved files then. I used Spyder for only a few days so far.

In both instances, the autosave file is empty (size: 0 kb). Their names are: pid460.txt and pid15468.txt. The times of creation, access, and modification are equal to each other (but not equal between the files), and are several hours before I closed spyder (after which the startup crash occurred). For clarity, this holds for the two files causing the two crashes, each file was created before the crash it caused. I installed Spyder 4.0.1 through anaconda, which was installed for my current (administrator) user only, but without providing administrator privileges. Then I updated using conda update anaconda, followed by conda update spyder. I did not install any other modification on python. My OS is Windows 10 Pro, 64 bit, version 1909. As mentioned by hmaarrfk, running spyder --reset did not work. I uninstalled and reinstalled Anaconda, and before updating Spyder from the version distributed with Anaconda (i.e., before conda update spyder), it worked, but after updating it, the error message returned. Removing the file allows Spyder to start, in both instances.

Further debugging data from the Anaconda Prompt, if it helps:

spyder --debug-output terminal --debug-info verbose
2020-02-13 13:04:48,838 [INFO] [spyder.app.mainwindow] -> Start of MainWindow constructor
2020-02-13 13:04:48,910 [INFO] [spyder.app.mainwindow] -> appusermodelid: 0
2020-02-13 13:04:48,940 [INFO] [spyder.app.mainwindow] -> End of MainWindow constructor
2020-02-13 13:04:48,940 [INFO] [spyder.app.mainwindow] -> *** Start of MainWindow setup ***
2020-02-13 13:04:48,942 [INFO] [spyder.app.mainwindow] -> Updating PYTHONPATH
2020-02-13 13:04:48,945 [INFO] [spyder.app.mainwindow] -> Applying theme configuration...
2020-02-13 13:04:48,947 [INFO] [spyder.app.mainwindow] -> Creating core actions...
2020-02-13 13:04:48,950 [INFO] [spyder.app.mainwindow] -> Creating toolbars...
2020-02-13 13:04:48,955 [INFO] [spyder.app.mainwindow] -> Creating Tools menu...
2020-02-13 13:04:49,132 [INFO] [spyder.app.mainwindow] -> Creating guidata and sift entries...
2020-02-13 13:04:49,136 [INFO] [spyder.app.mainwindow] -> Loading switcher...
2020-02-13 13:04:49,141 [INFO] [spyder.app.mainwindow] -> Loading internal console...
2020-02-13 13:04:49,265 [INFO] [keyring.backend] -> Loading KWallet
2020-02-13 13:04:49,268 [INFO] [keyring.backend] -> Loading SecretService
2020-02-13 13:04:49,271 [INFO] [keyring.backend] -> Loading Windows
2020-02-13 13:04:49,400 [INFO] [keyring.backend] -> Loading chainer
2020-02-13 13:04:49,402 [INFO] [keyring.backend] -> Loading macOS
2020-02-13 13:04:49,414 [INFO] [spyder.plugins.console.plugin] -> Initializing...
2020-02-13 13:04:49,992 [INFO] [spyder.app.mainwindow] -> Starting code completion manager...
2020-02-13 13:04:50,248 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Registering lsp
2020-02-13 13:04:50,302 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Registering kite
2020-02-13 13:04:50,302 [DEBUG] [spyder.plugins.completion.plugin] -> Completion plugin: Registering fallback
2020-02-13 13:04:50,302 [INFO] [spyder.app.mainwindow] -> Loading working directory...
2020-02-13 13:04:50,302 [DEBUG] [spyder.plugins.completion.fallback.actor] -> Fallback plugin starting...
2020-02-13 13:04:50,386 [INFO] [spyder.app.mainwindow] -> Loading help...
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel EdgeLine at floating
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel EdgeLine installed
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel IndentationGuide at floating
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel IndentationGuide installed
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel FoldingPanel at left
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel FoldingPanel installed
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel DebuggerPanel at left
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel DebuggerPanel installed
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel LineNumberArea at left
2020-02-13 13:04:50,433 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,449 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel LineNumberArea installed
2020-02-13 13:04:50,449 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel ClassFunctionDropdown at top
2020-02-13 13:04:50,449 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,449 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel ClassFunctionDropdown installed
2020-02-13 13:04:50,449 [DEBUG] [spyder.plugins.editor.panels.manager] -> adding panel ScrollFlagArea at right
2020-02-13 13:04:50,455 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,455 [DEBUG] [spyder.plugins.editor.panels.manager] -> panel ScrollFlagArea installed
2020-02-13 13:04:50,455 [DEBUG] [spyder.api.panel] -> ScrollFlagArea visibility changed
2020-02-13 13:04:50,455 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,455 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,455 [DEBUG] [spyder.plugins.editor.extensions.manager] -> adding extension CloseQuotesExtension
2020-02-13 13:04:50,455 [DEBUG] [spyder.plugins.editor.extensions.manager] -> adding extension SnippetsExtension
2020-02-13 13:04:50,455 [DEBUG] [spyder.plugins.editor.extensions.manager] -> adding extension CloseBracketsExtension
2020-02-13 13:04:50,471 [DEBUG] [spyder.api.panel] -> DebuggerPanel visibility changed
2020-02-13 13:04:50,471 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,471 [DEBUG] [spyder.api.panel] -> FoldingPanel visibility changed
2020-02-13 13:04:50,471 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,471 [DEBUG] [spyder.api.panel] -> ScrollFlagArea visibility changed
2020-02-13 13:04:50,471 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,471 [DEBUG] [spyder.api.panel] -> EdgeLine visibility changed
2020-02-13 13:04:50,471 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,471 [DEBUG] [spyder.api.panel] -> IndentationGuide visibility changed
2020-02-13 13:04:50,471 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,471 [DEBUG] [spyder.api.panel] -> LineNumberArea visibility changed
2020-02-13 13:04:50,471 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,487 [DEBUG] [spyder.api.panel] -> ClassFunctionDropdown visibility changed
2020-02-13 13:04:50,487 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,553 [DEBUG] [spyder.plugins.editor.panels.manager] -> Refresh panels
2020-02-13 13:04:50,596 [INFO] [spyder.app.mainwindow] -> Loading outline explorer...
2020-02-13 13:04:50,957 [INFO] [spyder.app.mainwindow] -> Loading editor...
2020-02-13 13:04:51,019 [DEBUG] [spyder.plugins.editor.utils.autosave] -> Reading pid file: C:\Users\USER1\.spyder-py3\autosave\pid15468.txt
Traceback (most recent call last):
  File "C:\Users\USER1\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3718, in main
    mainwindow = run_spyder(app, options, args)
  File "C:\Users\USER1\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3559, in run_spyder
    main.setup()
  File "C:\Users\USER1\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 955, in setup
    self.editor = Editor(self)
  File "C:\Users\USER1\Anaconda3\lib\site-packages\spyder\plugins\editor\plugin.py", line 178, in __init__
    self.autosave.try_recover_from_autosave()
  File "C:\Users\USER1\Anaconda3\lib\site-packages\spyder\plugins\editor\utils\autosave.py", line 176, in try_recover_from_autosave
    files_to_recover, pidfiles = self.get_files_to_recover()
  File "C:\Users\USER1\Anaconda3\lib\site-packages\spyder\plugins\editor\utils\autosave.py", line 149, in get_files_to_recover
    txt_as_dict = ast.literal_eval(txt)
  File "C:\Users\USER1\Anaconda3\lib\ast.py", line 46, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "C:\Users\USER1\Anaconda3\lib\ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 0

    ^
SyntaxError: unexpected EOF while parsing
[12376:8488:0213/130451.373:ERROR:broker_win.cc(59)] Error reading broker pipe: The pipe has been ended. (0x6D)

@ccordoba12 ccordoba12 modified the milestones: v4.2.0, v4.1.0 Feb 13, 2020
@jitseniesen
Copy link
Member

but maybe there is a way to deal with corrupt autosave files in a smoother way (in terms of user interaction), and without resetting other settings

Yes, this is the plan. Until we release a fix, you can delete the pidNNN.txt files (where NNN stands for some number); this will avoid resetting any settings.

What I don't yet understand is how these empty files get created in the first place.

In both instances, the autosave file is empty (size: 0 kb). Their names are: pid460.txt and pid15468.txt. The times of creation, access, and modification are equal to each other (but not equal between the files

I am not sure I understand you correctly. Do you mean that the creation, access, and modification times of the first file are equal, and that the creation, access, and modification times of the second file are equal, but that the times of the first file are not the same as the times of the second file?

@dn7
Copy link

dn7 commented Feb 14, 2020

Regarding the file timestamps, yes, you understood me correctly. The first file was created several hours before I closed the software, after which it did not start (the first startup crash). Likewise, the second file was created several hours beforeI I closed the software, after which the second crash happened (but after the first crash, of course).

@ccordoba12
Copy link
Member

What I don't yet understand is how these empty files get created in the first place.

@jitseniesen, why don't we skip those empty pid files until you're able to find a proper solution for this?

I mean, this error is pretty serious because it generates a crash at startup.

@jitseniesen
Copy link
Member

why don't we skip those empty pid files until you're able to find a proper solution for this?

I agree. I'm not sure I can do better.

@goanpeca
Copy link
Member

@jitseniesen just checking if you are going to work on this fix ;-)

Cheers!

@jitseniesen
Copy link
Member

just checking if you are going to work on this fix ;-)

I am planning to make at least a start on it on Thursday.

@goanpeca
Copy link
Member

Thanks a lot!

@goanpeca goanpeca modified the milestones: v4.1.0, Sprint 2 (February) Feb 18, 2020
@dn7
Copy link

dn7 commented Feb 20, 2020

Hi, I believe I have found the cause of the corrupt autosave files in my case. I had saved the scripts in a path that contained non-English characters. I get the error both with Arabic and with Hebrew characters separately. When the path does not contain such characters, the autosave folder does contain the temporary file and a pidNNN.txt file with content. Also, when the autosave happens in these situations, I get error messages in the software, as follows. I don't know if this is why @hmaarrfk got corrupt autosave files, too. By the way, the path did not contain spaces.
Since often a path, and even the base Windows username, contains foreign letters, I humbly suggest that it could be worth fixing, allowing the autosave to work in this situation (but even if you don't, to the very least, please inform the user when saving, like Matlab does with names that contain spaces). Are there other functions that do not work if the file path contains a foreign alphabet?
Thank you!

    autosave_filename = self.name_mapping[filename]
KeyError: 'C:\\Users\\USER1\\Documents\\USER1\\العربية\\hello_world.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\USER1\Anaconda3\lib\site-packages\spyder\plugins\editor\utils\autosave.py", line 116, in do_autosave
    stack.autosave.autosave_all()
  File "C:\Users\USER1\Anaconda3\lib\site-packages\spyder\plugins\editor\utils\autosave.py", line 375, in autosave_all
    self.maybe_autosave(index)
  File "C:\Users\USER1\Anaconda3\lib\site-packages\spyder\plugins\editor\utils\autosave.py", line 347, in maybe_autosave
    self.autosave(finfo)
  File "C:\Users\USER1\Anaconda3\lib\site-packages\spyder\plugins\editor\utils\autosave.py", line 360, in autosave
    autosave_filename = self.get_autosave_filename(finfo.filename)
  File "C:\Users\USER1\Anaconda3\lib\site-packages\spyder\plugins\editor\utils\autosave.py", line 313, in get_autosave_filename
    self.save_autosave_mapping()
  File "C:\Users\USER1\Anaconda3\lib\site-packages\spyder\plugins\editor\utils\autosave.py", line 258, in save_autosave_mapping
    pidfile.write(pprint.pformat(self.name_mapping))
  File "C:\Users\USER1\Anaconda3\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 38-44: character maps to <undefined>```

@jitseniesen
Copy link
Member

The PR does not address the encoding error in #11375 (comment) so I will open a new issue for this.

@jitseniesen
Copy link
Member

@dn7 That is a good hint for what the underlying issue might is, thanks! However, I don't understand why nobody reported that particular traceback.

@dn7
Copy link

dn7 commented Feb 20, 2020

Let me just stress that the UnicodeEncodeError error happens when editing a script, and I was able to close the error message and continue working. (I also did not understand what Unicodes have to do with running my simple script. I do now). The faulty startup happened later, after closing and opening.
Therefore, I had not realized the two problems were related. Sorry if this complicated things for you.

@hmaarrfk
Copy link
Author

in my case, I was hacking my kernel, and thingsjust get corrupt, then i have to hard reset my computer, so anything could be the problem.

That said, there should have been a guide to get out of that rut.

@goanpeca goanpeca linked a pull request Feb 21, 2020 that will close this issue
@jitseniesen
Copy link
Member

Sorry if this complicated things for you.

@dn7 No, it did not cause me any problems. The two problems need to be solved separately anyway, because the pidNNN.txt files can be corrupted by many different causes (like crashes while they are being written) and we need to handle that gracefully.

there should have been a guide to get out of that rut.

@hmaarrfk Agreed, and the next version will take care of that.

@sgolestanian
Copy link

I can't find this directory!
.config/spyder-py3/autosave/

where exactly should I look for?

@ccordoba12
Copy link
Member

That's for Linux. On Windows you have to look for .spyder-py3/autosave, inside your Users directory.

@hmaarrfk
Copy link
Author

hmaarrfk commented Mar 4, 2020

Thanks all, excited to see this in action!

@sgolestanian
Copy link

I don't know why but it's not there either

@sgolestanian
Copy link

this is the error that it returns

`Traceback (most recent call last):
File "C:\Users\Asus\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3718, in main
mainwindow = run_spyder(app, options, args)
File "C:\Users\Asus\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3559, in run_spyder
main.setup()
File "C:\Users\Asus\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 955, in setup
self.editor = Editor(self)
File "C:\Users\Asus\Anaconda3\lib\site-packages\spyder\plugins\editor\plugin.py", line 178, in init
self.autosave.try_recover_from_autosave()
File "C:\Users\Asus\Anaconda3\lib\site-packages\spyder\plugins\editor\utils\autosave.py", line 176, in try_recover_from_autosave
files_to_recover, pidfiles = self.get_files_to_recover()
File "C:\Users\Asus\Anaconda3\lib\site-packages\spyder\plugins\editor\utils\autosave.py", line 149, in get_files_to_recover
txt_as_dict = ast.literal_eval(txt)
File "C:\Users\Asus\Anaconda3\lib\ast.py", line 46, in literal_eval
node_or_string = parse(node_or_string, mode='eval')
File "C:\Users\Asus\Anaconda3\lib\ast.py", line 35, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "", line 0

^
SyntaxError: unexpected EOF while parsing
`

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

Successfully merging a pull request may close this issue.

6 participants