Closed OuO closed 8 years ago
What exactly fixes this PR? If in the config unicode literals are?
First, Sorry for unfriendly PR message.
I use Ubuntu 14.04. (w/ python 2.7.6 ) I try to execute change_wallpaper_reddit.py without '~/.config/change_wallpaper_reddit.rc' and it works fine~ and also with command arguments too.
But I configured '~/.config/change_wallpaper_reddit.rc' as 'example' and then try to run it.
I got error message
$ ./change_wallpaper_reddit.py Traceback (most recent call last): File "./change_wallpaper_reddit.py", line 66, in
config = load_config() File "./change_wallpaper_reddit.py", line 37, in load_config stream_read=stream.read())) TypeError: initial_value must be unicode or None, not str
So I try execute
try: config = ConfigParser(default) with open(config_path, "r") as stream: stream = StringIO("[{section_name}]\n{stream_read}".format(section_name=section_name, stream_read=stream.read()))
with same string as 'example' in my system. it also raise exception.
I think 'config' string should be convert to unicode. ( https://docs.python.org/2/library/stringio.html )
So I think import 'future.unicode_literals' better than add 'u' simbol in StringIO().
…load_config().