Comment #1 on issue 360 by tom.h.mi...@gmail.com: Encoding issues when
running without terminal
http://code.google.com/p/googlecl/issues/detail?id=360
I just went right for the config file :)
Try applying this patch and adding an option called "default_encoding =
utf-8" to the GENERAL section of your config file
(~/.config/googlecl/config). Please let me know if it does or does not work.
Attachments:
encoding_from_config.patch 1.0 KB
Unfortunately, there appears to be something wrong with that patch:
Traceback (most recent call last):
File "/usr/bin/google", line 54, in <module>
import googlecl
File "/usr/lib/pymodules/python2.6/googlecl/__init__.py", line 70, in
<module>
TERMINAL_ENCODING = determine_terminal_encoding()
File "/usr/lib/pymodules/python2.6/googlecl/__init__.py", line 52, in
determine_terminal_encoding
return_enc = googlecl.config.parser.safe_get('GENERAL',
AttributeError: 'module' object has no attribute 'safe_get'
Whoops. This patch (applied to 0.9.12) should actually fix the problem. If
you applied the patch from comment 1, you'll have to remove it.
There may be some garbled characters as GoogleCL gets started, but the
output you want from the cron job should come through.
Again, let me know if something's wrong. Thanks for the quick report
turnaround!
Attachments:
encoding_from_config2.patch 2.1 KB
Hey. Thanks again for your effort. However, it seems when
determine_terminal_encoding is called on module initialization (without
config) something goes wrong now.
Traceback (most recent call last):
File "/usr/bin/google", line 54, in <module>
import googlecl
File "/usr/lib/pymodules/python2.6/googlecl/__init__.py", line 75, in
<module>
TERMINAL_ENCODING = determine_terminal_encoding()
File "/usr/lib/pymodules/python2.6/googlecl/__init__.py", line 55, in
determine_terminal_encoding
if not return_enc:
UnboundLocalError: local variable 'return_enc' referenced before assignment
When I add "return_enc = 'utf-8'" before "if config is not None" (to see
what happens when the function is called the second time) I get this:
Traceback (most recent call last):
File "/usr/bin/google", line 839, in <module>
main()
File "/usr/bin/google", line 825, in main
run_once(options, args)
File "/usr/bin/google", line 530, in run_once
options.config)
File "/usr/bin/google", line 354, in import_service
config = googlecl.config.load_configuration(config_file_path)
File "/usr/lib/pymodules/python2.6/googlecl/config/__init__.py", line 89,
in load_configuration
googlecl.TERMINAL_ENCODING =
googlecl.determine_terminal_encoding(config)
File "/usr/lib/pymodules/python2.6/googlecl/__init__.py", line 54, in
determine_terminal_encoding
return_enc = config.parser.safe_get('GENERAL',
AttributeError: ConfigParser instance has no attribute 'safe_get'
Thanks for your patience with this. I've heard the third time is the charm,
so here's the third version of that patch (again applied to 0.9.12
directly).
(Your instinct with return_enc was right, but unfortunately I had a typo
with the config code, also fixed in this patch)
Attachments:
encoding_from_config3.patch 2.0 KB
Your latest patch indeed fixes the issue. Thanks.
Comment #7 on issue 360 by tom.h.mi...@gmail.com: Encoding issues when
running without terminal
http://code.google.com/p/googlecl/issues/detail?id=360
Finally! Sorry for all the botched attempts.
Closed by r542.