Reputation: 47
I'm using a library called Excel2Image in order to take a sheet range in excel and save it as a video. This library uses win32com in order to get an excel application.
Inside of my main program, consistently when I call the library's 'export_img' function, at one specific point in the function, the python program terminates despite having no exit
, quit
or sys.exit
type of function. There isn't an error or anything. It's just as if the program finished running normally. I went inside of the export_img function to find out what could be doing this
print(rng.Parent)
print('-')
for shape in rng.Parent.Shapes:
print(shape)
print('Checkpoint 2.2')
shape = None
del shape
print('Checkpoint 3')
where rng is a worksheet cell range object (rng = excel.workbook.Application.Range(_range)
)
The program terminates at the for loop, not printing a single shape. Nothing after, like "Checkpoint 2.2" gets printed, so something strange happens in that for loop.
Before the edits, the line was just for shape in rng.Parent.Shapes: pass
. The program prints everything up until the for loop where the program just ends. It doesn't print any shape nor execute any code afterwards. It consistently happens at one part of the program but I couldn't find out what about it actually causes it to fail. I tried adding a "try except" and use traceback to find an error if it was surpressed or something, but still nothing came up and the program terminated.
Upvotes: 0
Views: 33