This statement can fail when scripts do not have administrative rights to create files in the python script folder.
|
yacc.yacc(module=self, |
|
debug=self.debug, |
|
debugfile=self.debugfile, |
|
tabmodule=self.tabmodule) |
When it fails, the library emits this warning:
WARNING: Couldn't create 'dice_notation.parser.common_DiceParser_parsetab'. [Errno 13] Permission denied: 'C:\\Program Files (x86)\\Python37-32\\lib\\site-packages\\dice_notation\\parser\\common_DiceParser_parsetab.py'
The program continues running, but DiceParser().parse('d4 + 4').roll() always returns 8, which happens to be the highest value possible. The following is printed, but not raised:
Syntax error at 'd'
Illegal character ' '
Illegal character ' '
Perhaps a fail-fast approach would better suit this situation? After failing to write the parsetab, .roll() is invalidated so exceptions probably should be raised.