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

Python caught error failure #52

Open
robobenklein opened this issue Aug 4, 2020 · 3 comments
Open

Python caught error failure #52

robobenklein opened this issue Aug 4, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@robobenklein
Copy link
Member

[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

@robobenklein robobenklein added the bug Something isn't working label Aug 4, 2020
@jball1997
Copy link
Contributor

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
Copy link
Member Author

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants