You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from chalice import Chalice, Response
app = Chalice(app_name='example')
@app.route('/')
def index():
body = '<h1>test</h1>'
x = ''.join('a' for y in [1,2,3])
return Response(body=body,
status_code=200,
headers={'Content-Type': 'text/html'})
Expected Results
chalice gen-policy or chalice deploy should generate a policy or deploy the app
Actual Results
$ chalice gen-policy
Traceback (most recent call last):
File "/usr/local/bin/chalice", line 11, in <module>
load_entry_point('chalice==0.6.0', 'console_scripts', 'chalice')()
File "/usr/local/lib/python2.7/dist-packages/chalice/cli/__init__.py", line 298, in main
return cli(obj={})
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/chalice/cli/__init__.py", line 214, in gen_policy
generated = policy.policy_from_source_code(contents)
File "/usr/local/lib/python2.7/dist-packages/chalice/policy.py", line 20, in policy_from_source_code
client_calls = get_client_calls_for_app(source_code)
File "/usr/local/lib/python2.7/dist-packages/chalice/analyzer.py", line 74, in get_client_calls_for_app
binder = t.bind_types()
File "/usr/local/lib/python2.7/dist-packages/chalice/analyzer.py", line 331, in bind_types
self.visit(self._current_ast_namespace)
File "/usr/local/lib/python2.7/dist-packages/chalice/analyzer.py", line 540, in visit
return ast.NodeVisitor.visit(self, node)
File "/usr/lib/python2.7/ast.py", line 241, in visit
return visitor(node)
File "/usr/lib/python2.7/ast.py", line 249, in generic_visit
self.visit(item)
File "/usr/local/lib/python2.7/dist-packages/chalice/analyzer.py", line 540, in visit
return ast.NodeVisitor.visit(self, node)
File "/usr/lib/python2.7/ast.py", line 241, in visit
return visitor(node)
File "/usr/local/lib/python2.7/dist-packages/chalice/analyzer.py", line 390, in visit_Assign
self.generic_visit(node)
File "/usr/lib/python2.7/ast.py", line 251, in generic_visit
self.visit(value)
File "/usr/local/lib/python2.7/dist-packages/chalice/analyzer.py", line 540, in visit
return ast.NodeVisitor.visit(self, node)
File "/usr/lib/python2.7/ast.py", line 241, in visit
return visitor(node)
File "/usr/local/lib/python2.7/dist-packages/chalice/analyzer.py", line 424, in visit_Call
self.generic_visit(node)
File "/usr/lib/python2.7/ast.py", line 249, in generic_visit
self.visit(item)
File "/usr/local/lib/python2.7/dist-packages/chalice/analyzer.py", line 540, in visit
return ast.NodeVisitor.visit(self, node)
File "/usr/lib/python2.7/ast.py", line 241, in visit
return visitor(node)
File "/usr/lib/python2.7/ast.py", line 249, in generic_visit
self.visit(item)
File "/usr/local/lib/python2.7/dist-packages/chalice/analyzer.py", line 540, in visit
return ast.NodeVisitor.visit(self, node)
File "/usr/lib/python2.7/ast.py", line 241, in visit
return visitor(node)
File "/usr/lib/python2.7/ast.py", line 251, in generic_visit
self.visit(value)
File "/usr/local/lib/python2.7/dist-packages/chalice/analyzer.py", line 540, in visit
return ast.NodeVisitor.visit(self, node)
File "/usr/lib/python2.7/ast.py", line 241, in visit
return visitor(node)
File "/usr/local/lib/python2.7/dist-packages/chalice/analyzer.py", line 381, in visit_Name
self._symbol_table.get_inferred_type(node.id)
File "/usr/local/lib/python2.7/dist-packages/chalice/analyzer.py", line 241, in get_inferred_type
symbol = self._local_table.lookup(name)
File "/usr/lib/python2.7/symtable.py", line 100, in lookup
flags = self._table.symbols[name]
KeyError: 'y'
The text was updated successfully, but these errors were encountered:
gene1wood
changed the title
Analyzer throws exception when analyzing
Analyzer throws exception when analyzing list comprehension as argument
Mar 28, 2017
The analyzer has difficulty with code like this
For example in an app like this
Expected Results
chalice gen-policy
orchalice deploy
should generate a policy or deploy the appActual Results
The text was updated successfully, but these errors were encountered: