When I execute my python script in pydev/eclipse in debug mode everything works as expected I see this in the console:
The script creates some excel files with openpyxl and populates them with created .png files from matplotlib.pyplot but if I execute the script with the normal run:
Neither the excel files are created nor the .png files? In the normal run I do not see the above picture in the console
pydev version: 6.2.0.... openpyxl version: 2.5.2 matplotlib version: 2.2.2
i also checked the Run->Debug Configurations and Run->Run Configurations but the settings are the same
i start execution from my main script :
import script2 as sc2
def main():
sc2.start("test_1")
if __name__ == '__main__':
main()
from here if i execute/run with debug mode everything works but if i use the normal run mode it doesnt work. in this script2 the excel files are generated and populated with the .png files generated from matplotlib
Edit:
excel_file = str(file_path)
try:
wb = load_workbook(excel_file,read_only=False)
except OSError as e:
wb = openpyxl.Workbook()
wb.save(excel_file)
wb = load_workbook(excel_file,read_only=False)
wb.create_sheet(sheet_name)
sheet = wb[sheet_name]
sheet.column_dimensions['B'].width = 50
sheet.column_dimensions['C'].width = 80
sheet['A1'] = "Testing Res"
sheet['A1'].font = Font(color = '00FF00')
sheet['A1'].font = Font(name='Arial', size=12,bold=True)
sheet['A1'].alignment = Alignment(wrap_text=False)
for idx,values in enumerate(testing_list,1):
sheet["F"] = idx
sheet["G"] = elemnts[idx-1]
sheet["H"] = values['key1']
sheet["H32"] = "Description :"
sheet["I32"] = "balblablabl"
wb.save(excel_file)
and later some pictures with matplotlib:
wb= load_workbook(excel_file,read_only=False)
wb.create_sheet(result_graph)
sheet = wb[result_graph]
data_to_plot_1=[]
data_to_plot_2=[]
data_to_plot_3=[]
for s in sheet_names:
df = pd.read_excel(excel_file, s)
values = df._series['test_1']
data_to_plot_1.append(values )
for s in sheet_names:
df = pd.read_excel(excel_file, s)
values = df._series['test_2']
data_to_plot_2.append(values )
for s in sheet_names:
df = pd.read_excel(excel_file, s)
values = df._series['test_3']
data_to_plot_3.append(values )
boxplot_g(data_to_plot_1,'test_1.png','D3',1,title_1,x_name)
boxplot_g(data_to_plot_2,'test_2.png','D22',2,title_2,x_name)
boxplot_g(data_to_plot_3,'test_3.png','D42',3,title_3,x_name)
sheet = wb["Sheet"]
img = openpyxl.drawing.image.Image("test.jpg")
sheet.add_image(img,"D3")
wb.save(excel_file)