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

AssertionError caused by lark-parser==0.7.2 #25

Closed
jonhammer opened this issue Jul 30, 2019 · 5 comments
Closed

AssertionError caused by lark-parser==0.7.2 #25

jonhammer opened this issue Jul 30, 2019 · 5 comments

Comments

@jonhammer
Copy link

Tested in python 2.7.

>>> from commentjson import commentjson
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jhammer/Envs/test2/lib/python2.7/site-packages/commentjson/__init__.py", line 1, in <module>
    from .commentjson import dump
  File "/Users/jhammer/Envs/test2/lib/python2.7/site-packages/commentjson/commentjson.py", line 54, in <module>
    ''', start='start')
  File "/Users/jhammer/Envs/test2/lib/python2.7/site-packages/lark/lark.py", line 226, in __init__
    self.parser = self._build_parser()
  File "/Users/jhammer/Envs/test2/lib/python2.7/site-packages/lark/lark.py", line 245, in _build_parser
    parser_conf = ParserConf(self.rules, self._callbacks, self.options.start)
  File "/Users/jhammer/Envs/test2/lib/python2.7/site-packages/lark/common.py", line 23, in __init__
    assert isinstance(start, list)
AssertionError
@jonhammer jonhammer changed the title AssertionError caused by lark-parser>=0.7.2 AssertionError caused by lark-parser==0.7.2 Jul 30, 2019
@Sreevalli961
Copy link

Traceback (most recent call last):
File "C:\auto_fat\auto_fat_check.py", line 5, in
import commentjson
File "C:\Python27\lib\site-packages\commentjson_init_.py", line 1, in
from .commentjson import dump
File "C:\Python27\lib\site-packages\commentjson\commentjson.py", line 54, in
''', start='start')
File "C:\Python27\lib\site-packages\lark\lark.py", line 226, in init
self.parser = self._build_parser()
File "C:\Python27\lib\site-packages\lark\lark.py", line 245, in _build_parser
parser_conf = ParserConf(self.rules, self._callbacks, self.options.start)
File "C:\Python27\lib\site-packages\lark\common.py", line 23, in init
assert isinstance(start, list)
AssertionError

The same issue i am facing since this morning. I need to resolve this issue as soon as possible . can you help me out with this issue.

@Sreevalli961
Copy link

@jonhammer i resolved this issue . I think this step will resolve your issue also

In the commentjson.py file remove start = 'start'

parser = Lark('''
?start: value
?value: object
| array
| string
| SIGNED_NUMBER -> number
| "true" -> true
| "false" -> false
| "null" -> null
array : "[" [value ("," value)] "]"
object : "{" [pair ("," pair)
] "}"
pair : string ":" value
string : ESCAPED_STRING

COMMENT: /(#|\/\/)[^\\n]*/

%import common.ESCAPED_STRING
%import common.SIGNED_NUMBER
%import common.WS
%ignore WS
%ignore COMMENT

''' ,start = 'start')

@vaidik
Copy link
Owner

vaidik commented Aug 2, 2019

Confirm this. lark-parser==0.7.2 broke this. Wasn't a problem with 0.7.1

@vaidik
Copy link
Owner

vaidik commented Aug 2, 2019

Just made a release to fix this issue. Solution suggested by @Sreevalli961 helped. Thanks for that. :)

@vaidik vaidik closed this as completed Aug 2, 2019
@Sreevalli961
Copy link

Sreevalli961 commented Aug 2, 2019 via email

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