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

thriftpy2.load_fp can't load a thrift file with a include statement #285

Open
aisk opened this issue Jun 26, 2024 · 0 comments
Open

thriftpy2.load_fp can't load a thrift file with a include statement #285

aisk opened this issue Jun 26, 2024 · 0 comments

Comments

@aisk
Copy link
Member

aisk commented Jun 26, 2024

In the project's tests directory:

>>> import thriftpy2
>>> f = open('addressbook.thrift')
>>> thriftpy2.load_fp(f, 'addressbook_thrift')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/asaka/Codes/thriftpy2/thriftpy2/parser/__init__.py", line 171, in load_fp
    thrift = parse_fp(source, module_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/asaka/Codes/thriftpy2/thriftpy2/parser/parser.py", line 655, in parse_fp
    parser.parse(data)
  File "/Users/asaka/Codes/thriftpy2/venv/lib/python3.12/site-packages/ply/yacc.py", line 333, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/asaka/Codes/thriftpy2/venv/lib/python3.12/site-packages/ply/yacc.py", line 1120, in parseopt_notrack
    p.callable(pslice)
  File "/Users/asaka/Codes/thriftpy2/thriftpy2/parser/parser.py", line 58, in p_include
    raise ThriftParserError('Unexpected include statement while loading '
thriftpy2.parser.exc.ThriftParserError: Unexpected include statement while loading from file like object.
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

1 participant