pygerber icon indicating copy to clipboard operation
pygerber copied to clipboard

Empty line * causing parsing error

Open Argmaster opened this issue 1 year ago • 1 comments

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:

80600_50_6-ISS1.zip

please advise how to solve it.

Thanks,

Lily

80600_50_6-ISS1.zip

Originally posted by @lily-PHP in #361

Argmaster avatar Jan 20 '25 03:01 Argmaster

@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("*")

Argmaster avatar Jan 20 '25 03:01 Argmaster