utk-se / CodeAnalytics-analyzer

Single-shot code analysis for a code repo
1 stars 0 forks source link

Python caught error failure #52

Open robobenklein opened 4 years ago

robobenklein commented 4 years ago
[2020-08-04 08:41:16] [    INFO] [analyzer __init__] ./03.tools/src/annotation_task_si.py
[2020-08-04 08:41:16] [    INFO] [analyzer __init__] finished methods and parameters
[2020-08-04 08:41:16] [    INFO] [analyzer __init__] finished classes
Traceback (most recent call last):
  File "/home/ca-worker/venv/lib/python3.6/site-packages/CAanalyzer-0.0.7-py3.6.egg/caanalyzer/lib_finder.py", line 39, in find_libs
    my_ast = ast.parse(''.join(content))
  File "/usr/lib/python3.6/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 4
    class AnnotationTaskSI(Annotation)
                                     ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ca-worker/venv/lib/python3.6/site-packages/CAanalyzer-0.0.7-py3.6.egg/caanalyzer/lib_finder.py", line 51, in find_libs
    stderr=subprocess.STDOUT)
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['python2', '/home/ca-worker/venv/lib/python3.6/site-packages/CAanalyzer-0.0.7-py3.6.egg/caanalyzer/lib_finder.py', 'import sys\nimport src.annotation as an\n\nclass AnnotationTaskSI(Annotation)\n\n    def __init__(self, label=None, start_offset = None, end_offset=None): #, article_id=None):\n        \n        self.label = label\n        self.start_offset = int(start_offset)\n        self.end_offset = int(end_offset)\n\n\n    def get_label(self):\n\n        sys.error("ERRRO: trying to access technique label from file in SI task format")\n\n\n', './03.tools/src/annotation_task_si.py', 'py', '1']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ca-worker/venv/bin/ca-analyzer", line 11, in <module>
    load_entry_point('CAanalyzer==0.0.7', 'console_scripts', 'ca-analyzer')()
  File "/home/ca-worker/venv/lib/python3.6/site-packages/CAanalyzer-0.0.7-py3.6.egg/caanalyzer/__main__.py", line 21, in main
    pp.pprint(analyze(args.repopath))
  File "/home/ca-worker/venv/lib/python3.6/site-packages/CAanalyzer-0.0.7-py3.6.egg/caanalyzer/__main__.py", line 11, in analyze
    repo = analyzer.Repo(path, ignorefile, True)
  File "/home/ca-worker/venv/lib/python3.6/site-packages/CAanalyzer-0.0.7-py3.6.egg/caanalyzer/analyzer.py", line 220, in __init__
    file_obj = File(file_path, file_ext, tabsize)
  File "/home/ca-worker/venv/lib/python3.6/site-packages/CAanalyzer-0.0.7-py3.6.egg/caanalyzer/analyzer.py", line 693, in __init__
    self.libs = find_libs(lines, file_path, file_ext)
  File "/home/ca-worker/venv/lib/python3.6/site-packages/CAanalyzer-0.0.7-py3.6.egg/caanalyzer/lib_finder.py", line 58, in find_libs
    e.output.decode()))
RuntimeError: 
command '['python2', '/home/ca-worker/venv/lib/python3.6/site-packages/CAanalyzer-0.0.7-py3.6.egg/caanalyzer/lib_finder.py', 'import sys\nimport src.annotation as an\n\nclass AnnotationTaskSI(Annotation)\n\n    def __init__(self, label=None, start_offset = None, end_offset=None): #, article_id=None):\n        \n        self.label = label\n        self.start_offset = int(start_offset)\n        self.end_offset = int(end_offset)\n\n\n    def get_label(self):\n\n        sys.error("ERRRO: trying to access technique label from file in SI task format")\n\n\n', './03.tools/src/annotation_task_si.py', 'py', '1']'

return with error (code 1):
Traceback (most recent call last):
  File "/home/ca-worker/venv/lib/python3.6/site-packages/CAanalyzer-0.0.7-py3.6.egg/caanalyzer/lib_finder.py", line 130, in <module>
    print(find_libs(content=sys.argv[1], path=sys.argv[2], lang=sys.argv[3], py2=int(sys.argv[4])))
  File "/home/ca-worker/venv/lib/python3.6/site-packages/CAanalyzer-0.0.7-py3.6.egg/caanalyzer/lib_finder.py", line 33, in find_libs
    import astpretty
ImportError: No module named astpretty

(note the real error, above astpretty)

/tmp/ca-workdir/ca-worker-coretester1/job-https%3A%2F%2Fgithub.com%2Fbonsonsm%2F2020_Task11_NewsPropoganda.git

jball1997 commented 4 years ago

Ok so whatever machine you're running this on you'll have to install astpretty for python2 as well. I ran into this issue when I first worked on this and I'm sorry I forgot to mention that.

robobenklein commented 4 years ago

command '['python2', '/home/ca-worker/venv/lib/python3.6/site-packages/CAanalyzer-0.0.7-py3.6.egg/caanalyzer/lib_finder.py' ...
this is big oof

the voice in my head says we should not require a language's interpreter or compiler in order to analyze it, making me think there are yet larger design problems

jball1997 commented 4 years ago

Is it not working? I agree. I'll try and figure out something.