Spyder: SyntaxError when evaluating ast of autosave file

Created on 8 Feb 2020  路  13Comments  路  Source: spyder-ide/spyder

Issue Report Checklist

  • [x] Searched the issues page for similar reports
  • [x] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • [x] Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • [ ] Could not reproduce inside jupyter qtconsole (if console-related)
  • [x] Tried basic troubleshooting (if a bug/error)

    • [x] Restarted Spyder

    • [x] Reset preferences with spyder --reset

    • [x] Reinstalled the latest version of Anaconda

    • [x] Tried the other applicable steps from the Troubleshooting Guide

  • [ ] Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

What steps reproduce the problem?



    1. 2.
  1. 3.

What is the expected output? What do you see instead?

Paste Traceback/Error Below (if applicable)


Traceback (most recent call last):
  File "C:\Users\MisterOIlz\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3718, in main
    mainwindow = run_spyder(app, options, args)
  File "C:\Users\MisterOIlz\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3559, in run_spyder
    main.setup()
  File "C:\Users\MisterOIlz\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 955, in setup
    self.editor = Editor(self)
  File "C:\Users\MisterOIlz\Anaconda3\lib\site-packages\spyder\plugins\editor\plugin.py", line 178, in __init__
    self.autosave.try_recover_from_autosave()
  File "C:\Users\MisterOIlz\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\MisterOIlz\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\MisterOIlz\Anaconda3\lib\ast.py", line 46, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "C:\Users\MisterOIlz\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
[13252:12040:0208/170603.661:ERROR:broker_win.cc(59)] Error reading broker pipe: The pipe has been ended. (0x6D)

Versions

  • Spyder version: 4.0.1
  • Python version: 3.7.6
  • Qt version: 5.9.7
  • PyQt version: 5.9.2
  • Operating System name/version: Window 10

Dependencies

PASTE DEPENDENCIES HERE
Editor Bug

Most helpful comment

@jitseniesen @ccordoba12
Thank you so much.
I can open Spyder when I deleted pidxxxx.txt file.

All 13 comments

@jitseniesen, maybe this happen for files whose paths have unicode characters.

@molirun Hello锛宮y dear brother, I encountered a problem similar to yours, please try to execute the following command to solve it.

conda update --force conda

@molirun Hello锛宮y dear brother, I encountered a problem similar to yours, please try to execute the following command to solve it.

```
conda update --force conda

It not work for me.

Hi, I met the same problem


Attribute Qt::AA_UseSoftwareOpenGL must be set before QCoreApplication is created.
Traceback (most recent call last):
File "C:\Software\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3718, in main
mainwindow = run_spyder(app, options, args)
File "C:\Software\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3559, in run_spyder
main.setup()
File "C:\Software\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 955, in setup
self.editor = Editor(self)
File "C:\Software\Anaconda3\lib\site-packages\spyder\plugins\editor\plugin.py", line 178, in __init__
self.autosave.try_recover_from_autosave()
File "C:\Software\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:\Software\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:\Software\Anaconda3\lib\ast.py", line 48, in literal_eval
node_or_string = parse(node_or_string, mode='eval')
File "C:\Software\Anaconda3\lib\ast.py", line 35, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "", line 0

^

SyntaxError: unexpected EOF while parsing

My OS: winodws 10 pro, English version
Spyder: 4.0.1

@molirun, @RainyRen, please go to this directory:

C:\Users\<your user>\.spyder-py3\autosave

and upload a screenshot with the contents of that directory.

This is probably the same issue as reported in #11375

please go to this directory:

C:\Users\<your user>\.spyder-py3\autosave

and upload a screenshot with the contents of that directory.

I am particularly interested if there are any files called like pid6268.txt, but with a different number. Please show us the contents of the file (it may be empty).

As a workaround, try deleting the file (after you tell us what's in it).

@molirun, @RainyRen, please go to this directory:

C:\Users\<your user>\.spyder-py3\autosave

and upload a screenshot with the contents of that directory.
image

@molirun, thanks! Now please open the file called pid4288 and paste its contents here (if any).

It is empty.

@molirun, thanks!

@jitseniesen, I think that's the problem here. So simply skipping the autorecovery process if the pid file is empty should be enough to solve it.

@jitseniesen @ccordoba12
Thank you so much.
I can open Spyder when I deleted pidxxxx.txt file.

Duplicate of #11375

This is probably the same issue as reported in #11375

You were right @jitseniesen.

Was this page helpful?
0 / 5 - 0 ratings