Search code examples
pythonparsingconfigparserply

PLY - Hide output file


I am building my parser with PLY in python and when I run the parser it creates 3 files: parsetab.py, lextam.py and parse.out

How can I not create these files? Is there a parameter to do this? like: yacc.yacc(fileOutput=False)


Solution

  • The .out file is for debugging purposes. Pass debug=False to disable. To stop writing tables, pass write_tables=False. However, this is inefficient if you have a non-trivial grammar, because it PLY will keep regenerating tables upon each parser build (typically at instantiation of a parser, if building inside __init__). Read the PLY docs for more details.