elpy icon indicating copy to clipboard operation
elpy copied to clipboard

Non ASCII characters cause peculiar error in process sentinel

Open LeGuipo opened this issue 5 years ago • 3 comments

Summary

Hello, Emacs hangs for 2 seconds each time I move the cursor or add/remove a letter in a Python buffer containing some non ASCII characters anywhere in the script, generating each time the two following error messages :

error in process sentinel: elpy-rpc--default-error-callback: peculiar error: "exited abnormally with code 1"
error in process sentinel: peculiar error: "exited abnormally with code 1"

Removing all of the non ASCII characters from the buffer makes the background process to work back normally.

Steps to reproduce

Use this simple script:

# coding: utf-8

print('alors ça marche?')

Just try to move the buffer cursor to notice the issue. Erase the "ç" letter to bring back the background process alive again (2 tries are needed). Other characters like "é" also cause the issue.

My configuration

OS

Windows 10 64-bit

Result of (elpy-config)

Emacs.............: 26.3
Elpy..............: 1.34.0
Virtualenv........: None
Interactive Python: python 3.8.2 (c:/Program Files/Python38/python.exe)
RPC virtualenv....: rpc-venv (c:/Users/gupohu/AppData/Roaming/.emacs.d/elpy/rpc-venv)
 Python...........: c:/Windows/py.exe 3.8.2 (c:/Windows/py.exe)
 Jedi.............: 0.17.0
 Rope.............: 0.17.0
 Autopep8.........: 1.5.3
 Yapf.............: 0.30.0
 Black............: 19.10b0
Syntax checker....: pylint.exe (c:/Program Files/Python38/Scripts/pylint.exe)

Elpy configuration in my init.el

;; ELPY
(package-initialize)
(elpy-enable)

LeGuipo avatar Jun 13 '20 23:06 LeGuipo

Unicode seems to be handled properly on linux (at least on my machine). Probably an encoding problem. I'll have to try reproducing this on a windows machine.

In the meantime, I noticed the RPC process does not use the same python binaries (c:/Windows/py.exe) than the python shell (c:/Program Files/Python38/python.exe). You can already try this (setq elpy-rpc-python-command "c:/Program Files/Python38/python.exe"). It may makes things better.

galaunay avatar Nov 11 '20 13:11 galaunay

This issue might be sensitive to the Windows 10 build version: (UTF-8 support appears to be ≥ build 1903). @LeGuipo, would you please update this bug with that info?

https://techcommunity.microsoft.com/t5/windows-10/windows-10-1903-how-to-change-default-encoding-utf-8-to-ansi-in/m-p/991268 https://consignor.zendesk.com/hc/en-us/articles/360016886479-Errors-caused-by-Windows-10-Unicode-UTF-8-encoding and a couple of annoying gotchas are documented here: https://en.wikipedia.org/wiki/Unicode_in_Microsoft_Windows#UTF-8

As I don't use Windows I don't know if it still has the UTF-8 -> UTF-16 -/> UTF-8 problem.

sten0 avatar Dec 27 '20 19:12 sten0

I just tried the following:

  • Reinstalled Elpy V1.35
  • Added the setq command supplied by @galaunay
  • Checked the beta UTF-8 option in Windows (disabled by default)
  • The other registry trick only applies to Notepad. So I don't need to test this.
  • Updated Emacs from V26.3 to 27.1

Unfortunately the peculiar error is still present… Isn't there any way to get more details about it ?

Also, Emacs struggles a lot with space characters in paths, like c:/Program Files/… which breaks commands, so such paths need to be surrounded by double quote marks. I got a warning about flake8 not being detected, although it's properly installed. Would those spaces be the cause of the issue ?

LeGuipo avatar Dec 28 '20 19:12 LeGuipo