1

When I execute my python script in pydev/eclipse in debug mode everything works as expected I see this in the console:

enter image description here

enter image description here

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: enter image description here

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) 
friggler
  • 177
  • 2
  • 14
  • You need to give more info on what exactly doesn't work (do you have some error?) and a shorter script actually showing the code which is failing (it's not possible to give any feedback based on the info you provided). – Fabio Zadrozny Apr 26 '18 at 12:33
  • i added some snippets this all works in debug mode but not when i just click run – friggler Apr 26 '18 at 15:03
  • What exactly do you mean by `it doesn't work?` You have an exception, images are wrong? (can you post the output?) – Fabio Zadrozny Apr 26 '18 at 16:01
  • I mean the excel files are not generated and also the pictures are not generated, I can see it through the timestamps, there is no exception or error thrown – friggler Apr 26 '18 at 21:28
  • I feel like this is related to what is described here:https://stackoverflow.com/questions/13440956/interactive-matplotlib-through-eclipse-pydev – friggler Apr 26 '18 at 21:32

0 Answers0