amplify-education / python-hcl2

MIT License
236 stars 52 forks source link

Can't be installed on a read-only fs due to lark_parser.py creation #8

Closed sparvia closed 4 years ago

sparvia commented 4 years ago

The file lark_parser.py is generated "on-demand". However, the file is created in the same directory as where hcl2 is installed. If the directory is on a read-only filesystem, creation fails, and parsing is not possible. This happens if the code is e.g. run in an AWS Lambda function.

Generated files should instead be placed in /tmp. The filename can be generated using the tempfile module. An alternative would be to keep the current logic, but in case of file creation failure, fall back to writing the file to /tmp.

aoskotsky-amplify commented 4 years ago

Good point! The parser should be packaged now with the egg with this PR https://github.com/amplify-education/python-hcl2/pull/10 . Check it out