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

TypeError: list indices must be integers, not str #41

Open
dobesv opened this issue Jan 25, 2017 · 2 comments
Open

TypeError: list indices must be integers, not str #41

dobesv opened this issue Jan 25, 2017 · 2 comments

Comments

@dobesv
Copy link

dobesv commented Jan 25, 2017

Sometimes I get this error while compiling a template, but not always. I wonder if this library is not thread-safe?

Traceback (most recent call last):
  File "/home/dobes/env/lib/python2.7/site-packages/pybars/_compiler.py", line 827, in compile
    container = self._generate_code(source)
  File "/home/dobes/env/lib/python2.7/site-packages/pybars/_compiler.py", line 801, in _generate_code
    output = self._compiler(tree).apply('compile')[0]
  File "/home/dobes/env/lib/python2.7/site-packages/pymeta/runtime.py", line 299, in apply
    val, err = self._apply(r, ruleName, args)
  File "/home/dobes/env/lib/python2.7/site-packages/pymeta/runtime.py", line 329, in _apply
    [rule(), self.input])
  File "/pymeta_generated_code/pymeta_grammar__Grammar.py", line 11, in rule_compile
    self.considerError(lastError)
  File "/home/dobes/env/lib/python2.7/site-packages/pymeta/runtime.py", line 396, in many
    v, _ = fn()
  File "/pymeta_generated_code/pymeta_grammar__Grammar.py", line 8, in _G_many_2
    _G_exactly_1, lastError = self.exactly('-')
  File "/home/dobes/env/lib/python2.7/site-packages/pymeta/runtime.py", line 329, in _apply
    [rule(), self.input])
  File "/pymeta_generated_code/pymeta_grammar__Grammar.py", line 59, in rule_rule
    return (_G_apply_1, self.currentError)
  File "/home/dobes/env/lib/python2.7/site-packages/pymeta/runtime.py", line 414, in _or
    ret, err = f()
  File "/pymeta_generated_code/pymeta_grammar__Grammar.py", line 48, in _G_or_5
    return (_G_apply_1, self.currentError)
  File "/home/dobes/env/lib/python2.7/site-packages/pymeta/runtime.py", line 329, in _apply
    [rule(), self.input])
  File "/pymeta_generated_code/pymeta_grammar__Grammar.py", line 107, in rule_block
    _locals['x'] = _G_apply_1
  File "<string>", line 1, in <module>
  File "/home/dobes/env/lib/python2.7/site-packages/pybars/_compiler.py", line 554, in add_block
    self._locals[name] = nested
TypeError: list indices must be integers, not str
@isaacdd
Copy link
Collaborator

isaacdd commented Oct 7, 2018

@dobesv do you have an example template where this happens sometimes?

@pg1671
Copy link

pg1671 commented Mar 21, 2022

I get the same error occasionally. Have not had time to look into it further as it is not that often.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants