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

Crash because of UnicodeDecodeError #2

Open
mysterfr opened this issue Jun 14, 2018 · 2 comments
Open

Crash because of UnicodeDecodeError #2

mysterfr opened this issue Jun 14, 2018 · 2 comments

Comments

@mysterfr
Copy link

Hello,

I've followed the setup guide, ran astlog fine.
Trigger a search through F3 with a channel ID
Go to result list, try to tick the matching result with space => Crash with below exception :

Traceback (most recent call last):
  File "/data/python/env/astlog/astlog/astlog/app.py", line 1107, in run
    self.loop.run()
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/main_loop.py", line 286, in run
    self._run()
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/main_loop.py", line 384, in _run
    self.event_loop.run()
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/main_loop.py", line 788, in run
    self._loop()
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/main_loop.py", line 825, in _loop
    self._watch_files[fd]()
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/raw_display.py", line 404, in <lambda>
    event_loop, callback, self.get_available_raw_input())
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/raw_display.py", line 502, in parse_input
    callback(processed, processed_codes)
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/main_loop.py", line 411, in _update
    self.process_input(keys)
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/main_loop.py", line 511, in process_input
    k = self._topmost_widget.keypress(self.screen_size, k)
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/container.py", line 1131, in keypress
    return self.body.keypress( (maxcol, remaining), key )
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/container.py", line 2271, in keypress
    key = w.keypress((mc,) + size[1:], key)
  File "/data/python/env/astlog/astlog/astlog/app.py", line 479, in keypress
    return self.frame.keypress(size, key)
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/container.py", line 1131, in keypress
    return self.body.keypress( (maxcol, remaining), key )
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/listbox.py", line 999, in keypress
    key = focus_widget.keypress((maxcol,),key)
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/wimp.py", line 275, in keypress
    self.toggle_state()
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/wimp.py", line 438, in toggle_state
    self.set_state(True)
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/wimp.py", line 408, in set_state
    self.__super.set_state(state, do_callback)
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/wimp.py", line 240, in set_state
    self._emit('change', state)
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/widget.py", line 460, in _emit
    signals.emit_signal(self, name, self, *args)
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/signals.py", line 265, in emit
    result |= self._call_callback(callback, user_arg, user_args, args)
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/signals.py", line 295, in _call_callback
    return bool(callback(*args_to_pass))
  File "/data/python/env/astlog/astlog/astlog/app.py", line 484, in on_select_phone
    self._emit('select', call_id)
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/widget.py", line 460, in _emit
    signals.emit_signal(self, name, self, *args)
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/signals.py", line 265, in emit
    result |= self._call_callback(callback, user_arg, user_args, args)
  File "/data/python/env/astlog/local/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg/urwid/signals.py", line 295, in _call_callback
    return bool(callback(*args_to_pass))
  File "/data/python/env/astlog/astlog/astlog/app.py", line 1003, in on_result_selected
    self.log_display.load_result(ref)
  File "/data/python/env/astlog/astlog/astlog/app.py", line 673, in load_result
    self.refresh_log()
  File "/data/python/env/astlog/astlog/astlog/app.py", line 932, in refresh_log
    'Queue': 'asterisk-app',
  File "/data/python/env/astlog/astlog/astlog/app.py", line 326, in add
    found=found)
  File "/data/python/env/astlog/astlog/astlog/app.py", line 398, in _search
    level + 1, max_depth, found)
  File "/data/python/env/astlog/astlog/astlog/app.py", line 372, in _search
    start, end = finder(text)
  File "/data/python/env/astlog/astlog/astlog/app.py", line 420, in string_finder
    index = text.find(needle)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 184: ordinal not in range(128)

These were the installation messages:

running develop
running egg_info
creating astlog.egg-info
writing requirements to astlog.egg-info/requires.txt
writing astlog.egg-info/PKG-INFO
writing top-level names to astlog.egg-info/top_level.txt
writing dependency_links to astlog.egg-info/dependency_links.txt
writing entry points to astlog.egg-info/entry_points.txt
writing manifest file 'astlog.egg-info/SOURCES.txt'
reading manifest file 'astlog.egg-info/SOURCES.txt'
writing manifest file 'astlog.egg-info/SOURCES.txt'
running build_ext
Creating /data/python/env/astlog/lib/python2.7/site-packages/astlog.egg-link (link to .)
Adding astlog 0.5 to easy-install.pth file
Installing astlog script to /data/python/env/astlog/bin

Installed /data/python/env/astlog/astlog
Processing dependencies for astlog==0.5
Searching for urwid
Reading https://pypi.org/simple/urwid/
Downloading https://files.pythonhosted.org/packages/c7/90/415728875c230fafd13d118512bde3184d810d7bf798a631abc05fac09d0/urwid-2.0.1.tar.gz#sha256=644d3e3900867161a2fc9287a9762753d66bd194754679adb26aede559bcccbc
Best match: urwid 2.0.1
Processing urwid-2.0.1.tar.gz
Writing /tmp/easy_install-k3xuId/urwid-2.0.1/setup.cfg
Running urwid-2.0.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-k3xuId/urwid-2.0.1/egg-dist-tmp-D856HM
warning: no files found matching 'CHANGELOG'
creating /data/python/env/astlog/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg
Extracting urwid-2.0.1-py2.7-linux-x86_64.egg to /data/python/env/astlog/lib/python2.7/site-packages
Adding urwid 2.0.1 to easy-install.pth file

Installed /data/python/env/astlog/lib/python2.7/site-packages/urwid-2.0.1-py2.7-linux-x86_64.egg
Finished processing dependencies for astlog==0.5
@mysterfr
Copy link
Author

Not sure this is appropriate way to do it, but I fixed it in astlog file with:


#!/data/python/env/astlog/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'astlog','console_scripts','astlog'
__requires__ = 'astlog'
import re
import sys
from pkg_resources import load_entry_point

reload(sys)
sys.setdefaultencoding('utf-8')

[...]

@aerkaya1
Copy link

aerkaya1 commented Oct 30, 2020

reload(sys)
sys.setdefaultencoding('utf-8')

Adding these two lines solves the problem.
Thank you so much.

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