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

UnicodeDecodeError when opening a project #15340

Closed
leavor opened this issue Apr 19, 2021 · 8 comments
Closed

UnicodeDecodeError when opening a project #15340

leavor opened this issue Apr 19, 2021 · 8 comments

Comments

@leavor
Copy link

leavor commented Apr 19, 2021

Problem Description

Use the following command to upgrade to 5.0.1, can not start.

conda install spyder=5.0.1

What steps reproduce the problem?

spyder5 0 1无法启动

Paste Traceback/Error Below (if applicable)

No QCoreApplication instance found. Application patches not applied. You have to call load_stylesheet function after instantiation of QApplication to take effect.
Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\start.py", line 214, in main
    mainwindow.main(options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2311, in main
    mainwindow = create_window(app, splash, options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2172, in create_window
    main.post_visible_setup()
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 1300, in post_visible_setup
    self.projects.reopen_last_project()
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\plugins\projects\plugin.py", line 544, in reopen_last_project
    self.open_project(path=current_project_path,
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\plugins\projects\plugin.py", line 402, in open_project
    project_type_class = self._load_project_type_class(path)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\plugins\projects\plugin.py", line 812, in _load_project_type_class
    config.read(fpath)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\configparser.py", line 697, in read
    self._read(fp, filename)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\configparser.py", line 1017, in _read
    for lineno, line in enumerate(fp, start=1):
UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 233: illegal multibyte sequence

Versions

  • Spyder version: 5.0.1
  • Python version: 3.8.8
  • Qt version: 5.9.7
  • PyQt version: 5.9.2
  • Operating System name/version: win10
@ccordoba12
Copy link
Member

Hey @leavor, thanks for reporting. We'll take a look at this in our next version.

For now please run

spyder --reset

and don't create projects in directories that contain non-latin characters.

@leavor
Copy link
Author

leavor commented Apr 19, 2021

After use the "spyder --reset" in Anaconda,Spyder can start, but there is another problem.
First, I opened an existing project named "Algorithm", and failed. The bug report is the same as above.
Then, I created a new folder named "aaa" as a project folder, which also failed.

--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 113, in get_comm
    return self.comms[comm_id]
KeyError: '7802ea37a0b611eb8dcb1c1b0da66787'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\logging\__init__.py", line 1084, in emit
    stream.write(msg + self.terminator)
AttributeError: 'NoneType' object has no attribute 'write'
Call stack:
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\start.py", line 214, in main
    mainwindow.main(options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2311, in main
    mainwindow = create_window(app, splash, options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2207, in create_window
    app.exec_()
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 48, in _dispatch
    getattr(self, msg_type)(msg)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 172, in comm_msg
    comm = self.get_comm(comm_id)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 117, in get_comm
    self.log.warning("No such comm: %s", comm_id)
Message: 'No such comm: %s'
Arguments: ('7802ea37a0b611eb8dcb1c1b0da66787',)
--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 113, in get_comm
    return self.comms[comm_id]
KeyError: '7802ea37a0b611eb8dcb1c1b0da66787'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\logging\__init__.py", line 1084, in emit
    stream.write(msg + self.terminator)
AttributeError: 'NoneType' object has no attribute 'write'
Call stack:
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\start.py", line 214, in main
    mainwindow.main(options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2311, in main
    mainwindow = create_window(app, splash, options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2207, in create_window
    app.exec_()
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 48, in _dispatch
    getattr(self, msg_type)(msg)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 172, in comm_msg
    comm = self.get_comm(comm_id)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 117, in get_comm
    self.log.warning("No such comm: %s", comm_id)
Message: 'No such comm: %s'
Arguments: ('7802ea37a0b611eb8dcb1c1b0da66787',)
--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 113, in get_comm
    return self.comms[comm_id]
KeyError: '7802ea37a0b611eb8dcb1c1b0da66787'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\logging\__init__.py", line 1084, in emit
    stream.write(msg + self.terminator)
AttributeError: 'NoneType' object has no attribute 'write'
Call stack:
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\start.py", line 214, in main
    mainwindow.main(options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2311, in main
    mainwindow = create_window(app, splash, options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2207, in create_window
    app.exec_()
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 48, in _dispatch
    getattr(self, msg_type)(msg)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 172, in comm_msg
    comm = self.get_comm(comm_id)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 117, in get_comm
    self.log.warning("No such comm: %s", comm_id)
Message: 'No such comm: %s'
Arguments: ('7802ea37a0b611eb8dcb1c1b0da66787',)
--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 113, in get_comm
    return self.comms[comm_id]
KeyError: '7802ea37a0b611eb8dcb1c1b0da66787'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\logging\__init__.py", line 1084, in emit
    stream.write(msg + self.terminator)
AttributeError: 'NoneType' object has no attribute 'write'
Call stack:
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\start.py", line 214, in main
    mainwindow.main(options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2311, in main
    mainwindow = create_window(app, splash, options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2207, in create_window
    app.exec_()
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 48, in _dispatch
    getattr(self, msg_type)(msg)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 172, in comm_msg
    comm = self.get_comm(comm_id)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 117, in get_comm
    self.log.warning("No such comm: %s", comm_id)
Message: 'No such comm: %s'
Arguments: ('7802ea37a0b611eb8dcb1c1b0da66787',)
--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 113, in get_comm
    return self.comms[comm_id]
KeyError: '7802ea37a0b611eb8dcb1c1b0da66787'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\logging\__init__.py", line 1084, in emit
    stream.write(msg + self.terminator)
AttributeError: 'NoneType' object has no attribute 'write'
Call stack:
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\start.py", line 214, in main
    mainwindow.main(options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2311, in main
    mainwindow = create_window(app, splash, options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2207, in create_window
    app.exec_()
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 48, in _dispatch
    getattr(self, msg_type)(msg)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 172, in comm_msg
    comm = self.get_comm(comm_id)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 117, in get_comm
    self.log.warning("No such comm: %s", comm_id)
Message: 'No such comm: %s'
Arguments: ('7802ea37a0b611eb8dcb1c1b0da66787',)
--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 113, in get_comm
    return self.comms[comm_id]
KeyError: '7802ea37a0b611eb8dcb1c1b0da66787'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\logging\__init__.py", line 1084, in emit
    stream.write(msg + self.terminator)
AttributeError: 'NoneType' object has no attribute 'write'
Call stack:
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\start.py", line 214, in main
    mainwindow.main(options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2311, in main
    mainwindow = create_window(app, splash, options, args)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\spyder\app\mainwindow.py", line 2207, in create_window
    app.exec_()
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 48, in _dispatch
    getattr(self, msg_type)(msg)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 172, in comm_msg
    comm = self.get_comm(comm_id)
  File "C:\Users\Admin\Anaconda3\envs\python3.8.8\lib\site-packages\qtconsole\comms.py", line 117, in get_comm
    self.log.warning("No such comm: %s", comm_id)
Message: 'No such comm: %s'
Arguments: ('7802ea37a0b611eb8dcb1c1b0da66787',)

Finally, I opened the existing new project "aaa" , succeeded

spyder5 0 1无法使用中文目录

@ccordoba12
Copy link
Member

Please close Spyder, open the Anaconda prompt and run there

conda install jupyter_client=6.1.12

That should solve your problem.

@ccordoba12 ccordoba12 changed the title UnicodeDecodeError:Spyer can't startup UnicodeDecodeError when opening a project Apr 19, 2021
@ccordoba12
Copy link
Member

I found the second you reported above (i.e. the one with the very long error traceback) is a duplicate of issue #15356. We'll fix it in our next release.

@ccordoba12 ccordoba12 modified the milestones: v5.0.2, v5.0.3 Apr 25, 2021
@ccordoba12 ccordoba12 modified the milestones: v5.0.3, v5.1.0 May 15, 2021
@ccordoba12 ccordoba12 modified the milestones: v5.0.4, v5.1.0 May 24, 2021
@ccordoba12 ccordoba12 modified the milestones: v5.1.0, v5.1.1 Jul 26, 2021
@ccordoba12 ccordoba12 modified the milestones: v5.1.1, v5.1.2 Aug 2, 2021
@ccordoba12 ccordoba12 modified the milestones: v5.1.2, v5.2.0 Aug 11, 2021
@ccordoba12 ccordoba12 modified the milestones: v5.2.0, v5.2.1 Sep 28, 2021
@leavor
Copy link
Author

leavor commented Sep 29, 2021

Hi, @ccordoba12 , I have fixed this bug.
image

I changed the code in this file, "python\Lib\site-packages\spyder\plugins\projects\plugin.py"
However, I am not sure about the impact of this on spyder's entire project.
image

@ccordoba12
Copy link
Member

Hi, @ccordoba12 , I have fixed this bug.

Hey @leavor, that's really good to hear!

Do you want me to submit a pull request for this? Or do you prefer to do it?

@ccordoba12 ccordoba12 modified the milestones: v5.2.1, v5.2.0 Sep 30, 2021
@leavor
Copy link
Author

leavor commented Sep 30, 2021

@ccordoba12 Yes, you submit a PR.

@ccordoba12
Copy link
Member

Ok, no problem. I'll do it.

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

No branches or pull requests

2 participants