diff --git a/src/files.py b/src/files.py index 1698a5b..0dc303c 100644 --- a/src/files.py +++ b/src/files.py @@ -35,7 +35,7 @@ def natural_sort(l): return sorted(l, key=alphanum_key) -def get_export_names(): +def get_export_names(filepath, exports_path): r""" Return a list with the names of the files in the folder /Exports. @@ -45,7 +45,7 @@ def get_export_names(): Save files names. """ if exports_path == "": - return [] + exports_path = filepath filenames = natural_sort(os.listdir(exports_path)) for i, filename in enumerate(filenames): # Removes the .csv @@ -95,7 +95,7 @@ def get_sitl_modules_names(filepath): def export_plots(file_name, filepath, names, data, T): global exports_path file_name += "_0" - export_names = get_export_names() + export_names = get_export_names(filepath, exports_path) number_found = False counter = 0 diff --git a/src/simulation/main_simulation.py b/src/simulation/main_simulation.py index e95ceb8..fa6003b 100644 --- a/src/simulation/main_simulation.py +++ b/src/simulation/main_simulation.py @@ -998,6 +998,9 @@ def export_plots(file_name): if name != "Off": names_to_csv.append(name) plots_to_csv = [t_plot] + if first_plot == []: + print("There is nothing to export, please run a simulation.") + return None if first_plot[0] != None: plots_to_csv.append(first_plot) if second_plot[0] != None: