twitter: Fix buggy handling of config_file in Python 3.

This fixes the most broken part of #88.
This commit is contained in:
Tim Abbott 2017-08-22 17:19:57 -07:00
parent 409bb58742
commit 9c18c0b4ed
2 changed files with 5 additions and 5 deletions

View file

@ -35,9 +35,9 @@ CONFIGFILE = os.path.expanduser("~/.zulip_twitterrc")
def write_config(config, since_id, user): def write_config(config, since_id, user):
# type: (ConfigParser, int, int) -> None # type: (ConfigParser, int, int) -> None
config.set('twitter', 'since_id', since_id) config.set('twitter', 'since_id', str(since_id))
config.set('twitter', 'user_id', user) config.set('twitter', 'user_id', str(user))
with open(CONFIGFILE, 'wb') as configfile: with open(CONFIGFILE, 'w') as configfile:
config.write(configfile) config.write(configfile)
parser = zulip.add_default_arguments(argparse.ArgumentParser(r""" parser = zulip.add_default_arguments(argparse.ArgumentParser(r"""

View file

@ -37,8 +37,8 @@ def write_config(config, since_id):
# type: (ConfigParser, int) -> None # type: (ConfigParser, int) -> None
if 'search' not in config.sections(): if 'search' not in config.sections():
config.add_section('search') config.add_section('search')
config.set('search', 'since_id', since_id) config.set('search', 'since_id', str(since_id))
with open(CONFIGFILE, 'wb') as configfile: with open(CONFIGFILE, 'w') as configfile:
config.write(configfile) config.write(configfile)
parser = zulip.add_default_arguments(argparse.ArgumentParser(r""" parser = zulip.add_default_arguments(argparse.ArgumentParser(r"""