Js2Py icon indicating copy to clipboard operation
Js2Py copied to clipboard

KeyError: 'name' in VariableDeclarator

Open brechtm opened this issue 6 years ago • 0 comments

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/evaljs.py", line 75, in translate_file
    py_code = translate_js(js)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translator.py", line 70, in translate_js
    parsed)  # syntax tree to python code
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 121, in trans
    return node(**ele)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 550, in Program
    code = ''.join(trans(e) for e in body)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 550, in <genexpr>
    code = ''.join(trans(e) for e in body)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 121, in trans
    return node(**ele)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 535, in VariableDeclaration
    code = ''.join(trans(d) for d in declarations)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 535, in <genexpr>
    code = ''.join(trans(d) for d in declarations)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 121, in trans
    return node(**ele)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 530, in VariableDeclarator
    return 'var.put(%s, %s)\n' % (repr(name), trans(init))
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 121, in trans
    return node(**ele)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 138, in f
    res = func(**args)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 207, in CallExpression
    return trans(callee) + '(%s)' % ', '.join(arguments)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 121, in trans
    return node(**ele)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 631, in FunctionExpression
    code = trans(body)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 121, in trans
    return node(**ele)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 345, in BlockStatement
    body)  # never returns empty string! In the worst case returns pass\n
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 453, in StatementList
    code = ''.join(trans(e) for e in lis)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 453, in <genexpr>
    code = ''.join(trans(e) for e in lis)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 121, in trans
    return node(**ele)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 535, in VariableDeclaration
    code = ''.join(trans(d) for d in declarations)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 535, in <genexpr>
    code = ''.join(trans(d) for d in declarations)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 121, in trans
    return node(**ele)
  File "/Users/brechtm/Documents/Code/structed/venv/lib/python3.7/site-packages/js2py/translators/translating_nodes.py", line 526, in VariableDeclarator
    name = id['name']
KeyError: 'name'

Let me know what I can provide to help debug this issue.

brechtm avatar Aug 08 '19 23:08 brechtm