After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 462475 - crash due Non-ASCII characters in .orca/user-settings.py file
crash due Non-ASCII characters in .orca/user-settings.py file
Status: RESOLVED FIXED
Product: orca
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Rich Burridge
Orca Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-08-01 14:02 UTC by Carlos Eduardo Rodrigues Diógenes
Modified: 2007-08-07 18:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix the problem. (1.69 KB, patch)
2007-08-01 19:13 UTC, Rich Burridge
committed Details | Review

Description Carlos Eduardo Rodrigues Diógenes 2007-08-01 14:02:13 UTC
I was trying to reproduce the bug #462044 and after installing gnome-mag and orca from trunk I get the following error trying to running orca:

GTK Accessibility Module initialized
Traceback (most recent call last):
  • File "<string>", line 1 in <module>
  • File "/usr/lib/python2.5/site-packages/orca/orca.py", line 1462 in main
    init(registry)
  • File "/usr/lib/python2.5/site-packages/orca/orca.py", line 1135 in init
    loadUserSettings()
  • File "/usr/lib/python2.5/site-packages/orca/orca.py", line 893 in loadUserSettings
    _userSettings = __import__("user-settings")
  • File "/home/carlosd/.orca/user-settings.py", line 121
SyntaxError: Non-ASCII character '\xc3' in file /home/carlosd/.orca/user-settings.py on line 121, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

The content of line 121 is:

orca.pronunciation_dict.pronunciation_dict["ASAP"]="o mais cedo possível"

translating the string to english, it's something like "the earlier possible"
Comment 1 Willie Walker 2007-08-01 14:54:26 UTC
I'm not quite exactly sure what should be done to resolve this - the link mentioned in the bug opener seems to give some information, but I'm not sure exactly what the right thing to do is.  Rich, I'm going to give this one to you.  :-)
Comment 2 Rich Burridge 2007-08-01 15:21:54 UTC
I'd already started looking at it. ;-)

Adding the following line, as the very first line in ~/.orca/user-settings.py
seems to fix the problem.

# -*- coding: latin-1 -*-

Will, does that seem the right thing to do?
Comment 3 Rich Burridge 2007-08-01 15:24:59 UTC
If this is the correct fix, it would also have to be the
first line of any ~/.orca/app-settings/<appname>.py files too.
Comment 4 Willie Walker 2007-08-01 15:37:36 UTC
> # -*- coding: latin-1 -*-
> 
> Will, does that seem the right thing to do?

I'm not sure.  :-(  The reason being is that we might end up saving things for non-latin-1 locales, like Chinese.  I wonder if there is a way to ask Python for the coding that's currently in use when we write out the file?
Comment 5 Rich Burridge 2007-08-01 16:58:18 UTC
I'm not finding how to ask Python for the coding that is currently in use.
There must be a way, I'm just not finding it by googling around.

But having said that, isn't there something that we can output that will
act like a superset of all the possible character encodings we might encounter?

For example, adding the following line:

# This Python file uses the following encoding: utf-8

at the top of ~/.orca/user-settings.py (instead of the previous one),
also fixes the problem for the "o mais cedo possível" example. 
No SyntaxError and the TTS engine nicely spoke the Latin characters.

I then changed the lines in user-settings.py to:

orca.pronunciation_dict.pronunciation_dict["ASAP"]="look chinese chars: 请你不要
哭"

and there was no SyntaxError at Orca startup time. The TTS couldn't speak 'em,
but that's a separate problem.
Comment 6 Rich Burridge 2007-08-01 19:13:26 UTC
Created attachment 92880 [details] [review]
Patch to fix the problem.

This seems to work nicely.
Comment 7 Rich Burridge 2007-08-01 19:16:47 UTC
Patch committed to gnome-2-20 branch and HEAD. Put the bug into
a "[pending]" state.
Comment 8 Mike Pedersen 2007-08-07 17:03:59 UTC
I just tested the latest orca with the above example and orca seemed to start just fine. 
Comment 9 Rich Burridge 2007-08-07 18:44:27 UTC
Thanks Mike. Closing as FIXED.