Handles pkg_resources byte strings in Python 3 correctly

item-del-count
Scott 8 years ago
parent b80377d4b0
commit 8317f30697

@ -20,11 +20,11 @@ def main():
if args.generate_configs: if args.generate_configs:
if not os.path.isfile("shreddit.yml"): if not os.path.isfile("shreddit.yml"):
print("Writing shreddit.yml file...") print("Writing shreddit.yml file...")
with open("shreddit.yml", "w") as fout: with open("shreddit.yml", "wb") as fout:
fout.write(pkg_resources.resource_string("shreddit", "shreddit.yml.example")) fout.write(pkg_resources.resource_string("shreddit", "shreddit.yml.example"))
if not os.path.isfile("praw.ini"): if not os.path.isfile("praw.ini"):
print("Writing praw.ini file...") print("Writing praw.ini file...")
with open("praw.ini", "w") as fout: with open("praw.ini", "wb") as fout:
fout.write(pkg_resources.resource_string("shreddit", "praw.ini.example")) fout.write(pkg_resources.resource_string("shreddit", "praw.ini.example"))
return return

Loading…
Cancel
Save