Bug#784330: game-data-packager without arguments refuses to run due to Python error
Le mardi 5 mai 2015, 19:37:36 Simon McVittie a écrit : On 05/05/15 15:18, Alexandre Detiste wrote: Would something like this be ok ? +longname = self.longname.replace('ł','l') Ugh, I'd rather not special-case the non-ASCII characters that happen to appear in the names of games that we support... Ok, it's ugly, but at least it's hidden in a function in util.py; this function is also called by check_syntax.py . but perhaps this is a necessary evil in the short term. I had been updating the same system since 2002, and was stuck with Latin-1 encoding; it was quite a bit of work to rename all the files to uft8, I understand some people never bother to change the locale. This patch only implement ascii vs utf8; people still using Latin-2 (Eastern European) encoding will be served ascii Soltys too. Proper handling would need a str.encode(sys.stdout.encoding) in a try/except block + testing with this locale configured; for little gain. Having the wrapper shell script set something like PYTHONIOENCODING=:replace if it detects the C locale might also be a reasonable workaround. That replaces the characters with '?'s -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#784330: game-data-packager without arguments refuses to run due to Python error
Hi, Thanks for your bug repport. It bugs on Sołtys http://www.charbase.com/0142-unicode-latin-small-letter-l-with-stroke G-D-P is well supposed to handle unicode correclty, a temporary workaround is to either edit or delete this file: /usr/share/games/game-data-packager/soltys.json 2015-05-05 16:30 GMT+02:00 vbdasc vbd...@hotmail.com: vbdasc@mail:/tmp$ game-data-packager File /usr/lib/python3.4/argparse.py, line 2374, in _print_message UnicodeEncodeError: 'ascii' codec can't encode character '\u0142' in position 2912: ordinal not in range(128) As such, the package is unusable for me. Alexandre -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#784330: game-data-packager without arguments refuses to run due to Python error
Package: game-data-packager Version: 41 Severity: important Dear Maintainer, game-data-packager ver.41 without arguments doesn't start at all; I get this output instead: vbdasc@mail:/tmp$ game-data-packager Traceback (most recent call last): File /usr/lib/python3.4/runpy.py, line 170, in _run_module_as_main __main__, mod_spec) File /usr/lib/python3.4/runpy.py, line 85, in _run_code exec(code, run_globals) File /usr/share/games/game-data-packager/game_data_packager/__main__.py, line 21, in module run_command_line() File /usr/share/games/game-data-packager/game_data_packager/__init__.py, line 2786, in run_command_line parser.print_help() File /usr/lib/python3.4/argparse.py, line 2368, in print_help self._print_message(self.format_help(), file) File /usr/lib/python3.4/argparse.py, line 2374, in _print_message file.write(message) UnicodeEncodeError: 'ascii' codec can't encode character '\u0142' in position 2912: ordinal not in range(128) As such, the package is unusable for me. -- System Information: Debian Release: stretch/sid APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores) Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Shell: /bin/sh linked to /bin/dash Init: sysvinit (via /sbin/init) Versions of packages game-data-packager depends on: ii fakeroot1.20.2-1 ii python3 3.4.2-2 ii python3-debian 0.1.27 ii python3-yaml3.11-2 pn python3:any none game-data-packager recommends no packages. Versions of packages game-data-packager suggests: ii arj3.10.22-13 ii binutils 2.25-7 ii cabextract 1.6-1 pn cdparanoia none ii dynamite 0.1.1-2 ii gcc4:4.9.2-3 ii gir1.2-gtk-3.0 3.14.5-1 ii gir1.2-pango-1.0 1.36.8-3 pn innoextractnone ii lgc-pg 1.2.6-1 pn lhasa | jlha-utils | lzh-archiver none ii make 4.0-8.1 ii p7zip-full 9.20.1~dfsg.1-4.1 ii python3-gi 3.14.0-1 pn unace-nonfree none pn unrar-nonfree none pn unshield none ii unzip 6.0-16 ii vorbis-tools 1.4.0-6 -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#784330: game-data-packager without arguments refuses to run due to Python error
On 05/05/15 15:30, vbdasc wrote: Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Your locale cannot represent the names of all the supported games. If you are intentionally using a language-neutral locale, please prefer C.UTF-8 (available since jessie). g-d-p could cope with this better, although it's really more a question of Python could cope with this better: https://bugs.python.org/issue19846 As a workaround, you can set the PYTHONIOENCODING environment variable to something like utf8 or :replace: PYTHONIOENCODING=:replace game-data-packager --help Regards, S -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#784330: game-data-packager without arguments refuses to run due to Python error
Simon, Would something like this be ok ? --- a/game_data_packager/__init__.py +++ b/game_data_packager/__init__.py @@ -2129,9 +2129,14 @@ class GameData(object): def add_parser(self, parsers, base_parser, **kwargs): aliases = self.aliases +if sys.stdout.encoding == 'UTF-8': +longname = self.longname +else: +longname = self.longname.replace('ł','l') + parser = parsers.add_parser(self.shortname, -help=self.longname, aliases=aliases, -description='Package data files for %s.' % self.longname, +help=longname, aliases=aliases, +description='Package data files for %s.' % longname, -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#784330: game-data-packager without arguments refuses to run due to Python error
On 05/05/15 15:18, Alexandre Detiste wrote: Would something like this be ok ? +if sys.stdout.encoding == 'UTF-8': +longname = self.longname +else: +longname = self.longname.replace('ł','l') Ugh, I'd rather not special-case the non-ASCII characters that happen to appear in the names of games that we support... but perhaps this is a necessary evil in the short term. See also https://bugs.python.org/issue19977 https://hg.python.org/cpython/rev/bc06f67234d0 which indicate that Python itself is likely to fix this in 3.5. Having the wrapper shell script set something like PYTHONIOENCODING=:replace if it detects the C locale might also be a reasonable workaround. S -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org