[PyGerber]: error=tile cannot extend outside image;error=Expected end of text, found '%' (at char 134), (line:10, col:1)
PyGerber Bug Report
error=tile cannot extend outside image error=Expected end of text, found '%' (at char 134), (line:10, col:1)
Code:
try:
paras = sys.argv[1:]
paras = [1, "D:/N3_S2CD0012C00_Gerber_V1/smk_c1.gbr","D:/N3_S2CD0012C00_Gerber_V1/ab2.png"]
if(len(paras) > 2):
cal_type = paras[0]
files = []
if(cal_type == 0):
for filename in os.listdir(paras[1]):
if os.path.isfile(os.path.join(paras[1], filename)) and filename.lower().endswith(".gbr"):
print(os.path.join(paras[1], filename)) # 输出文件名
files.append(os.path.join(paras[1], filename))
else:
files = paras[1].split(",")
save_file = paras[2]
gerber_files = []
for index, item in enumerate(files) :
filename, file_extension_cuts = os.path.splitext(item)
gerber_files.append(GerberFile.from_file(
item,
FileTypeEnum.infer_from_extension(file_extension_cuts.lower())
))
if(len(gerber_files) >0):
Project(gerber_files).parse().render_raster(save_file,image_format=ImageFormatEnum.PNG,pixel_format=PixelFormatEnum.RGBA)
print("success",save_file, sep="=")
else:
print("failure=gerber files is null or damage!")
else:
print("error=args error!")
except Exception as ex_result:
print("error", ex_result, sep="=")
@Argmaster A detailed response has been provided via email concerning the abnormal information.I'm waiting for your response.
Hi, sorry for the late response.
Error messages seem to be two separate errors. Could you please provide a full stack trace?
First error sounds like something coming from Pillow.
Second error could be caused by some syntax construction not recognized by PyGerber.
I don't recall getting an email from you, at least recently, so I might have misunderstood your comment or something.
Either way, it would help a lot if you could share source files (or at least a single file which allows you to reproduce this error) either here or if you can't publicly share them, at least email them to me ([email protected]).
If neither is possible I would need you to compose a minimal Gerber file that allows you to repro the problem but contains as little of the design as possible and post it here.
Without a Gerber (.grb) source file I can't do much debug unfortunately.
=====================Single layers============================
Traceback (most recent call last):
File "D:\workspace_py\gerberserver\render_file_cmd.py", line 10, in
=====================Multiple layers============================
Traceback (most recent call last): File "D:\workspace_py\gerberserver.venv\Lib\site-packages\PIL\ImageFile.py", line 644, in _save fh = fp.fileno() ^^^^^^^^^ AttributeError: '_idat' object has no attribute 'fileno'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\workspace_py\gerberserver\render_file_cmd.py", line 31, in
At 2025-09-11 10:50:22, "Krzysztof Wiśniewski" @.***> wrote:
Argmaster left a comment (Argmaster/pygerber#389)
Hi, sorry for the late response. Error messages seem to be two separate errors. Could you please provide a full stack trace? First error sounds like something coming from Pillow. Second error could be caused by some syntax construction not recognized by PyGerber. I don't recall getting an email from you, at least recently, so I might have misunderstood your comment or something. Either way, it would help a lot if you could share source files (or at least a single file which allows you to reproduce this error) either here or if you can't publicly share them, at least email them to me @.***). If neither is possible I would need you to compose a minimal Gerber file that allows you to repro the problem but contains as little of the design as possible and post it here. Without a Gerber (.grb) source file I can't do much debug unfortunately.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
@Argmaster Sorry, I sent the email to the wrong recipient. I've just resent it to you.
@Argmaster The email also attached the Gerber file. I'm waiting for your response.