Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf-8 encoding should be default for the open() statement #1

Closed
Silver-Volt4 opened this issue Oct 30, 2021 · 2 comments
Closed

utf-8 encoding should be default for the open() statement #1

Silver-Volt4 opened this issue Oct 30, 2021 · 2 comments

Comments

@Silver-Volt4
Copy link

I found this script with google, it's insane that it's only been published yesterday.
Anyway, to make it work for me, I had to add this to the open() statement:
encoding="utf-8"
So that would make:
with open(subreddit + '_' + thing + '_' + str(int(time.time())) + '.txt', 'w', encoding="utf-8") as f:

other than that, thanks for the script, it's great!

@guneetsinghchatha
Copy link
Owner

Thank you so much for this - I will patch the issue ASAP
Also if you have issues with the data being in single quotes this seemed to fix all the data issues for me - https://gist.github.com/mbrzusto/23fe728966247f25f3ec

@Silver-Volt4
Copy link
Author

Silver-Volt4 commented Oct 30, 2021

You will most likely want to use f.write(json.dumps(data)) as a fix, instead of a plain str()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants