Origin Ver. 2021b and Service Release (Select Help-->About Origin):
Operating System: Win 10 ent
Hi,
I am trying to plot a 8x12 plots (see picture attached) using originpro module in python and a template. However, when the software is trying to plot the graph I get the following error:
gl_0 = gr1[0]
TypeError: 'NoneType' object is not subscriptable
If I try a 4x4 plot, everything is working fine. Appreciate any help.
The code is below:
def origin_shutdown_exception_hook(exctype, value, traceback):
'''Ensures Origin gets shut down if an uncaught exception'''
op.exit()
sys.__excepthook__(exctype, value, traceback)
if op and op.oext:
sys.excepthook = origin_shutdown_exception_hook
if op.oext:
op.set_show(True)
wks = op.new_sheet(lname = 'HTCD') # for normal plots
wks.name = 'HTCD'
wks.from_list(0, htcd_file[0], lname='Wavelength', units='nm')
for i in range(1, 97):
wks.from_list(i, htcd_file[i], lname=f'{i}', comments=f'spectrum {i}')
path_template = os.getcwd()
new_path_template = path_template.replace('/', '\\')
gr1 = op.new_graph(template=(new_path_template + '\\Origin templates\\htcd.otpu'), lname='HTCD')
gl_0 = gr1[0]
g0 = gl_0.add_plot(wks, coly='B', colx='A', type=202)
gl_1= gr1[1]
p1 = gl_1.add_plot(wks, coly='C', colx='A', type=202)