pygerber
pygerber copied to clipboard
Empty line * causing parsing error
I got same error message when I parse a GBS file.
here is my code:
from pygerber.gerberx3.api.v2 import FileTypeEnum, GerberFile parsed_file = GerberFile.from_file( "./80600_50_6-ISS1/80600_50_6-ISS1_bott_resist.GBS", file_type=FileTypeEnum.INFER_FROM_ATTRIBUTES ).parse() print(parsed_file.get_info()) print(parsed_file.get_file_type())here I attach my gerber zip file:
please advise how to solve it.
Thanks,
Lily
Originally posted by @lily-PHP in #361
@lily-PHP thank you for reporting the issue. I think that the problem is caused by * present in empty lines not preceded by any command. I am not sure if it violates the standard but we could add a workaround since i cant see a reason why this would be disruptive. I will work on that soon. If you were interested in contributing this fix yourself, you could try adding in line 371 in src/pygerber/gerberx3/tokenizer/grammar.py just after | comment
| Suppress("*")