Cannot initialize

Bug #781821 reported by hector
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Pythoscope
New
Undecided
Unassigned

Bug Description

Cannot initialize because of a unicode problem:

(new)[13:27] hector@duo17:~/new-pylons/new/lib$ pythoscope --init
INFO: Inspecting module db_util.py.
ERROR: Oops, it seems that an internal Pythoscope error occurred. Please file a bug report at https://bugs.launchpad.net/pythoscope

Traceback (most recent call last):
  File "/home/hector/.virtualenvs/new/bin/pythoscope", line 8, in <module>
    load_entry_point('pythoscope==0.4.3', 'console_scripts', 'pythoscope')()
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/__init__.py", line 184, in main
    init_project(project_path)
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/__init__.py", line 112, in init_project
    inspect_project_statically(project)
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/inspector/__init__.py", line 55, in inspect_project_statically
    return add_and_update_modules(project) + \
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/inspector/__init__.py", line 37, in add_and_update_modules
    static.inspect_module(project, modpath)
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/inspector/static.py", line 130, in inspect_module
    return inspect_code(project, path, read_file_contents(path))
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/inspector/static.py", line 139, in inspect_code
    visitor = descend(tree, ModuleVisitor)
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/astvisitor.py", line 20, in descend
    visitor.visit(tree)
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/astvisitor.py", line 155, in visit
    self.visit_node(tree)
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/astvisitor.py", line 169, in visit_node
    getattr(self, method)(results)
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/astvisitor.py", line 191, in _visit_all
    self.visit(results['nodes'])
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/astvisitor.py", line 158, in visit
    self.visit(subtree)
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/astvisitor.py", line 155, in visit
    self.visit_node(tree)
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/astvisitor.py", line 169, in visit_node
    getattr(self, method)(results)
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/astvisitor.py", line 196, in _visit_class
    body=results['body'])
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/inspector/static.py", line 91, in visit_class
    methods = [create_definition(n, a, c, Method) for (n, a, c) in visitor.methods]
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/inspector/static.py", line 74, in create_definition
    is_generator=is_generator_definition(code))
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/inspector/static.py", line 66, in is_generator_definition
    return is_generator_code(function_code_from_definition(definition))
  File "/home/hector/.virtualenvs/new/lib/python2.6/site-packages/pythoscope/inspector/static.py", line 52, in function_code_from_definition
    consts = compile_without_warnings(unindent(str(definition))).co_consts
  File "/usr/lib/python2.6/lib2to3/pytree.py", line 228, in __str__
    return unicode(self).encode("ascii")
  File "/usr/lib/python2.6/lib2to3/pytree.py", line 265, in __unicode__
    return u"".join(map(unicode, self.children))
  File "/usr/lib/python2.6/lib2to3/pytree.py", line 265, in __unicode__
    return u"".join(map(unicode, self.children))
  File "/usr/lib/python2.6/lib2to3/pytree.py", line 265, in __unicode__
    return u"".join(map(unicode, self.children))
  File "/usr/lib/python2.6/lib2to3/pytree.py", line 265, in __unicode__
    return u"".join(map(unicode, self.children))
  File "/usr/lib/python2.6/lib2to3/pytree.py", line 265, in __unicode__
    return u"".join(map(unicode, self.children))
  File "/usr/lib/python2.6/lib2to3/pytree.py", line 265, in __unicode__
    return u"".join(map(unicode, self.children))
  File "/usr/lib/python2.6/lib2to3/pytree.py", line 371, in __unicode__
    return self.prefix + unicode(self.value)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 40: ordinal not in range(128)

Revision history for this message
Michal Kwiatkowski (ruby) wrote :

Thank you for the report. Could you also attach the db_util.py file that causes the error?

Revision history for this message
Luc Stepniewski (lstep) wrote :
Download full text (4.3 KiB)

I also get the message for several projects. For example, Pyajam:

$ pythoscope -t nose -i
INFO: Inspecting module __init__.py.
INFO: Inspecting module pyajam.py.
ERROR: Oops, it seems that an internal Pythoscope error occurred. Please file a bug report at https://bugs.launchpad.net/pythoscope

Traceback (most recent call last):
  File "/home/lstep/workspace/GIT/PYAJAM/bin/pythoscope", line 8, in <module>
    load_entry_point('pythoscope==0.4.3', 'console_scripts', 'pythoscope')()
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/__init__.py", line 184, in main
    init_project(project_path)
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/__init__.py", line 112, in init_project
    inspect_project_statically(project)
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/inspector/__init__.py", line 55, in inspect_project_statically
    return add_and_update_modules(project) + \
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/inspector/__init__.py", line 37, in add_and_update_modules
    static.inspect_module(project, modpath)
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/inspector/static.py", line 130, in inspect_module
    return inspect_code(project, path, read_file_contents(path))
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/inspector/static.py", line 139, in inspect_code
    visitor = descend(tree, ModuleVisitor)
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/astvisitor.py", line 20, in descend
    visitor.visit(tree)
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/astvisitor.py", line 155, in visit
    self.visit_node(tree)
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/astvisitor.py", line 169, in visit_node
    getattr(self, method)(results)
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/astvisitor.py", line 191, in _visit_all
    self.visit(results['nodes'])
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/astvisitor.py", line 158, in visit
    self.visit(subtree)
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/astvisitor.py", line 155, in visit
    self.visit_node(tree)
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/astvisitor.py", line 169, in visit_node
    getattr(self, method)(results)
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/astvisitor.py", line 196, in _visit_class
    body=results['body'])
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/inspector/static.py", line 91, in visit_class
    methods = [create_definition(n, a, c, Method) for (n, a, c) in visitor.methods]
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/inspector/static.py", line 74, in create_definition
    is_generator=is_generator_definition(code))
  File "/home/lstep/workspace/GIT/PYAJAM/lib/python2.7/site-packages/pythoscope/inspector/static.py", line 66,...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.