CloudBotIRC / CloudBot

CloudBot - The simple, fast, expandable, open-source Python IRC Bot!
GNU General Public License v3.0
273 stars 249 forks source link

Strange error #177

Closed paris-ci closed 8 years ago

paris-ci commented 9 years ago
Message: "[harmony:#harmonyhosting] <xClaaD> c'est pas bien de juger comme \xe7a o_be_one ^^"
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.4/logging/__init__.py", line 980, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 82: ordinal not in range(128)
Call stack:
  File "/usr/lib/python3.4/threading.py", line 888, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 65, in _worker
    work_item.run()
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/cloudbot/CloudBot/cloudbot/plugin.py", line 340, in _execute_hook_threaded
    return hook.function(*parameters)
  File "/home/cloudbot/CloudBot/plugins/log.py", line 242, in console_log
    bot.logger.info(text)
Message: '[harmony:#harmonyhosting] <WayToDoor> Bah ils peuvent test un pr\xe9prod sur un vps et voir'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.4/logging/__init__.py", line 980, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 71: ordinal not in range(128)
Call stack:
  File "/usr/lib/python3.4/threading.py", line 888, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 65, in _worker
    work_item.run()
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/cloudbot/CloudBot/cloudbot/plugin.py", line 340, in _execute_hook_threaded
    return hook.function(*parameters)
  File "/home/cloudbot/CloudBot/plugins/log.py", line 242, in console_log
    bot.logger.info(text)
Message: '[harmony:#harmonyhosting] <xClaaD> quentin go pv me d\xe9velopper ton argumentation'
Arguments: ()````
MikeRixWolfe commented 9 years ago

That's a unicode error in "/home/cloudbot/CloudBot/plugins/log.py", line 242. It looks weird because of the threading.

edwardslabs commented 9 years ago

The logging error can be fixed by changing your server local to utf-8.

paris-ci commented 9 years ago

@edwardslabs I can't find such option in the config. Could you be more precise ?

edwardslabs commented 9 years ago

@paris-ci your server's locale is likely set to a non-UTF-8 languange you can see this with

echo $LANG

If you set your server's locale to en_US.UTF-8 or fr_FR.UTF-8 the bot will be able to write unicode text to the file system.

paris-ci commented 9 years ago

Oh, you mean the physical server !

root@api-d:~# echo $LANG
fr_FR.UTF-8

cloudbot@api-d:~/CloudBot$ echo $LANG
fr_FR.UTF-8

But still the same error :(

edwardslabs commented 9 years ago

Did you restart the bot? If $LANG was already set to fr_FR.UTF-8 can you try en_US.UTF-8?

paris-ci commented 9 years ago

I did, and the language was set like that for ages. I'll try to change the locate to en_US.UTF-8, and i'll tell you the result

paris-ci commented 9 years ago

It seems to work with that locale !

Duckle29 commented 8 years ago

Is changing the server locale really considered the fix? This bug crashes the bot for me.

--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.4/logging/__init__.py", line 980, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 67: ordinal not in range(128)
Call stack:
  File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/cloud_bot/CloudBot/cloudbot/__main__.py", line 85, in <module>
    main()
  File "/home/cloud_bot/CloudBot/cloudbot/__main__.py", line 57, in main
    restart = _bot.run()
  File "/home/cloud_bot/CloudBot/cloudbot/bot.py", line 132, in run
    restart = self.loop.run_until_complete(self.stopped_future)
  File "/usr/lib/python3.4/asyncio/base_events.py", line 304, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.4/asyncio/base_events.py", line 276, in run_forever
    self._run_once()
  File "/usr/lib/python3.4/asyncio/base_events.py", line 1172, in _run_once
    handle._run()
  File "/usr/lib/python3.4/asyncio/events.py", line 120, in _run
    self._callback(*self._args)
  File "/home/cloud_bot/CloudBot/cloudbot/clients/irc.py", line 210, in _send
    logger.info("[{}] >> {}".format(self.name, line))
Message: '[BaphoNet] >> PRIVMSG #savagegods :(Generic) \x02Pok\xe9mon Theme Song\x02 - length \x023m 22s\x02 - 129,398 likes, 4,162 dislikes (\x0296.9\x02%) - \x0221,055,093\x02 views - \x02Arcanine299\x02 on \x022008.03.30\x02 - http://youtu.be/JuYeHPFR3f0'
Arguments: ()
Red-M commented 8 years ago

There is a python hack to pull every string ever created to utf8 but that could cause issues else where. Change your locale to the utf variant.

On 17/03/2016, Mikkel Jeppesen notifications@github.com wrote:

Is changing the server locale really considered the fix? This bug crashes the bot for me.

--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.4/logging/__init__.py", line 980, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position
67: ordinal not in range(128)
Call stack:
  File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/cloud_bot/CloudBot/cloudbot/__main__.py", line 85, in
<module>
    main()
  File "/home/cloud_bot/CloudBot/cloudbot/__main__.py", line 57, in main
    restart = _bot.run()
  File "/home/cloud_bot/CloudBot/cloudbot/bot.py", line 132, in run
    restart = self.loop.run_until_complete(self.stopped_future)
  File "/usr/lib/python3.4/asyncio/base_events.py", line 304, in
run_until_complete
    self.run_forever()
  File "/usr/lib/python3.4/asyncio/base_events.py", line 276, in
run_forever
    self._run_once()
  File "/usr/lib/python3.4/asyncio/base_events.py", line 1172, in _run_once
    handle._run()
  File "/usr/lib/python3.4/asyncio/events.py", line 120, in _run
    self._callback(*self._args)
  File "/home/cloud_bot/CloudBot/cloudbot/clients/irc.py", line 210, in
_send
    logger.info("[{}] >> {}".format(self.name, line))
Message: '[BaphoNet] >> PRIVMSG #savagegods :(Generic) \x02Pok\xe9mon Theme
Song\x02 - length \x023m 22s\x02 - 129,398 likes, 4,162 dislikes
(\x0296.9\x02%) - \x0221,055,093\x02 views - \x02Arcanine299\x02 on
\x022008.03.30\x02 - http://youtu.be/JuYeHPFR3f0'
Arguments: ()

You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/CloudBotIRC/CloudBot/issues/177#issuecomment-197772790