Hi. I am working on Ubuntu 18.04. Geany and geany-plugins 1.38 compiled from sources. I experienced that, if in the file:
- ~/.local/lib/python3.6/site-packages/altre-cartelle.pth
there is any non strictly ASCII byte, the debugger will not start when the Run button is clicked. Executing geany from the console, I can read the output:
Failed to import the site module Traceback (most recent call last): File "/usr/lib/python3.6/site.py", line 570, in <module> main() File "/usr/lib/python3.6/site.py", line 556, in main known_paths = addusersitepackages(known_paths) File "/usr/lib/python3.6/site.py", line 291, in addusersitepackages addsitedir(user_site, known_paths) File "/usr/lib/python3.6/site.py", line 213, in addsitedir addpackage(sitedir, name, known_paths) File "/usr/lib/python3.6/site.py", line 169, in addpackage for n, line in enumerate(f): File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 66: ordinal not in range(128)
Removing the non ASCII bytes, the debugger runs without problems. Ciao. Massimo
My native language is not English, please excuse me any incorrectness, I apologize for any inconvenience caused, thank you
This looks like a Python problem, nothing to do with Geany.
Python appears to read the site packages with an ASCII codec, is your locale setup correctly?
Does GDB work if run from the terminal on the same file?
Have you been trying to create a file like:
- ~/.local/lib/python3.6/site-packages/file.pth
with a non ASCII character, like òàè, and run the debugger plugin? Just to verify whether the issue happens only in my system.
In my system the locale command produces:
LANG=it_IT.UTF-8 LANGUAGE=it_IT LC_CTYPE="it_IT.UTF-8" LC_NUMERIC="it_IT.UTF-8" LC_TIME="it_IT.UTF-8" LC_COLLATE="it_IT.UTF-8" LC_MONETARY="it_IT.UTF-8" LC_MESSAGES="it_IT.UTF-8" LC_PAPER="it_IT.UTF-8" LC_NAME="it_IT.UTF-8" LC_ADDRESS="it_IT.UTF-8" LC_TELEPHONE="it_IT.UTF-8" LC_MEASUREMENT="it_IT.UTF-8" LC_IDENTIFICATION="it_IT.UTF-8" LC_ALL=
It seems ok.
I use a python sub-system with different locations for the modules and for this reason I use the .pth file. I use a great deal of python programs but I never experienced problems with it before using the debugger plugin.
I verified that gdb works if I run it from the terminal on the same file and putting some non ASCII character in the .pth file, therefore the problem is not in the gdb itself.
I don't have experience in geany code but I ask myself why would the debugger plugin use python code. Maybe because it is predisposed to support python debugging? Massimo massimo
why would the debugger plugin use python code.
The debugger plugin is a UI to run the GDB debugger, which has Python embedded in it as an [extension language](https://sourceware.org/gdb/onlinedocs/gdb/Python.html#Python).
Clearly Geany and therefore the spawned GDB seem to be being run in an ASCII locale (probably the default "C" locale).
Are you starting Geany from the command line or a desktop menu? If menu try from the command line. Many menus do not run a shell, they just fork the program, so if you set the locale in one of your shell startup scripts it will not be set when Geany runs.
The issue happens also starting geany from the command line where, as I've just written, the locale command produces:
LANG=it_IT.UTF-8 LANGUAGE=it_IT LC_CTYPE="it_IT.UTF-8" LC_NUMERIC="it_IT.UTF-8" LC_TIME="it_IT.UTF-8" LC_COLLATE="it_IT.UTF-8" LC_MONETARY="it_IT.UTF-8" LC_MESSAGES="it_IT.UTF-8" LC_PAPER="it_IT.UTF-8" LC_NAME="it_IT.UTF-8" LC_ADDRESS="it_IT.UTF-8" LC_TELEPHONE="it_IT.UTF-8" LC_MEASUREMENT="it_IT.UTF-8" LC_IDENTIFICATION="it_IT.UTF-8" LC_ALL=
Well, I tried setting the only LC unset variable, that is LC_ALL, executing the command:
LC_ALL="it_IT.UTF-8" geany
and that solves the problem.
I tried also setting LC_RESPONSE, that is missing in the locale output, but that doesn't have effect. The weird thing is, anyway, that gdb itself doesn't produce the issue; only when gdb is started fron the debugger plugin.
Can it be a good idea to mention this fact in the debugger plugin web page? Massimo
-- My native language is not English, please excuse me any incorrectness, I apologize for any inconvenience caused, thank you
I forgot you can see what locale Geany thinks its in by looking at `Help->Debug Messages` which should say something like:
``` Geany INFO : Geany 1.39 (git >= b7558417), en_AU.UTF-8 ```
Note LC_ALL environment variable is a convenience to override all the other variables with its value, it does not need to be set if all the other variables are set. Geany calls `setlocale(LC_ALL, "")` as required to set the various locale categories according to [precedence order defined in 8.2 here](https://pubs.opengroup.org/onlinepubs/007904875/basedefs/xbd_chap08.html#tag...)
Python site.py changed in 3.10 to explicitly use your LC_CTYPE value to read `.pth` files, so maybe it uses LC_ALL in 3.6 and so assumes ASCII when its not set.
In my case `Help->Debug Messages` always gives:
`Geany INFO : Geany 1.38 (git >= acb7b066), it_IT.UTF-8`
also when the issue happens.
-- My native language is not English, please excuse me any incorrectness, I apologize for any inconvenience caused, thank you
github-comments@lists.geany.org