-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
UnicodeEncodeError Logger exception with iso8859_2 encoding (non UTF-8) #64
Comments
Hi @vserbu ! Could you share your config.yml file's content (obscuring the sensitive data, like the tokens, etc.), it seems the YAML parser is complaining about the formatting but I'm not sure what specifically is causing it. |
I'm wondering if you used the config.yml.sample file on this repo and maybe this line does not have the final ending quote Line 41 in 97bded2
Which would cause issues while trying to parse it. |
@vserbu
If you really need that colon in a mapping's value for whatever reason (specifying a port, for example), you could put it inside quotes:
|
I must point out that I could not install pleroma bot with pip install pleroma-bot because i always got: Could not find a version that satisfies the requirement pleroma-bot (from versions: ) No matching distribution found for pleroma-bot So I installed it with pip3 install pleroma-bot. |
Could you comment out using
|
And by the way, if you're using Mastodon you need your account ID (it's a limitation with the API). If you are an admin or a moderator on the instance you can find the ID of an user this way too:
|
I'm the admin at salocha.online and I've found account ID but everything is the same. I tried again but this time with complete and not minimal config.yml . (I used minimal yml because I thought that it is going to be easier). I would like to copy/paste complete config.yml here but it is not possible, because the styling is messing with the text. Here is the link to my config.yml - https://justpaste.it/5zr0e I left XXXXX for all the tokens and keys for the privacy. Do I have to #comment the keys I don't use like: consumer_key: xxxxxxxxxxxxxxxxxxxxxxxxx |
For pasting the content here, you can wrap it with backticks:
The minimal config should be fine, those keys you mentioned are only needed if the Twitter account you're mirroring has their tweets protected. They're optional but if they are present Start with something simple first:
In the link you provided you seem to have repeated users with the same Twitter account too, which I'm not sure it is what you're trying to do. If you get any errors please provide the output and I'll try to help out. |
@vserbu
|
I tried with again with minimal config.yml and with UTF-8 encoding, I think something changed: |
Just to clarify, I'm trying to mirror twitter account @ScifiNow (I just picked it for testing reasons). |
Does your Twitter API project has Elevated access? It was introduced recently and it is needed for Twitter's API v1.1 |
No, maybe that is a problem. I thought that for this purpose I need only basic api? |
That was the case until recently, when Twitter pushed out v2 out of early access and in the process limited v1.1 to Elevated: Here's the breakdown of the levels: And we would happily migrate to v2, however there are missing features which are only available on v1.1 at the moment. |
Hmm...I'm not sure they will approve me v2 for Mastodon bots. Do you have bots working with this script and using v1.1 api? |
You should have Essential access by default, which has access to Twitter's API v2. Other people were able to request it and be granted access in the past for this usecase: |
Aha, I understand. I'll try. |
Thank you!! |
No problem! If you don't mind, I'll reuse this issue for the problem you had with the encoding (so you don't have to launch the bot using PYTHONIOENCODING=UTF-8 everytime). |
Of course, and thank you for the really fine script with lots of options included. I hope I'm not going to abuse it, my primary intention was to select few interesting sci-fi twitter accounts and bot them to mastodon. I suppose I have to make a cron job to run the script every hour or so to pick up the new tweets? |
Yeah, to abuse it I think you would have to be doing millions of requests a day, I'm pretty sure you won't run into issues on that front. And yes, you can use cron or a systemd service to fetch new tweets periodically: |
Oh, and I forgot to add that
You lose the ability of getting their profile info (because there's no "main" account) though. |
Is there another way to add another twitter username in series so I can get profile info and everything? Like two or more minimal config ymls merged. Are there any rules how to make that config? |
I guess you could achieve that with something along the lines of:
This would get the tweets from the 3 Twitter accounts (not updating the Fedi profile), You can add as many users in series as you want. |
For some reason I get error for the first (multiple twitter acc:) and the second version (combination). Here is the error log for the multiple twitter acc: (maybe there is another way to separate twitter accounts?) . . . |
It looks like it's taking the
instead of:
If that's not it, maybe sharing your current config could help us find what the issue is. |
You were right, one again, the space between the dashes were missing. Tnx. |
I've got an error, what can I do? This is the error log:
2022-02-12 08:55:45,426 pleroma_bot ERROR: Exception occurred
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pleroma_bot/cli.py", line 363, in main
config = yaml.safe_load(stream)
File "/usr/local/lib/python3.8/dist-packages/yaml/init.py", line 125, in safe_load
return load(stream, SafeLoader)
File "/usr/local/lib/python3.8/dist-packages/yaml/init.py", line 81, in load
return loader.get_single_data()
File "/usr/local/lib/python3.8/dist-packages/yaml/constructor.py", line 49, in get_single_data
node = self.get_single_node()
File "/usr/local/lib/python3.8/dist-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/usr/local/lib/python3.8/dist-packages/yaml/composer.py", line 58, in compose_document
self.get_event()
File "/usr/local/lib/python3.8/dist-packages/yaml/parser.py", line 118, in get_event
self.current_event = self.state()
File "/usr/local/lib/python3.8/dist-packages/yaml/parser.py", line 193, in parse_document_end
token = self.peek_token()
File "/usr/local/lib/python3.8/dist-packages/yaml/scanner.py", line 129, in peek_token
self.fetch_more_tokens()
File "/usr/local/lib/python3.8/dist-packages/yaml/scanner.py", line 223, in fetch_more_tokens
return self.fetch_value()
File "/usr/local/lib/python3.8/dist-packages/yaml/scanner.py", line 577, in fetch_value
raise ScannerError(None, None,
yaml.scanner.ScannerError: mapping values are not allowed here
in "/usr/local/lib/python3.8/dist-packages/pleroma_bot/config.yml", line 2, column 17
The text was updated successfully, but these errors were encountered: