diff --git a/anomaly/image_str/scripts/image_str/parse_img.py b/anomaly/image_str/scripts/image_str/parse_img.py index 87b436fe..d4d16bf4 100755 --- a/anomaly/image_str/scripts/image_str/parse_img.py +++ b/anomaly/image_str/scripts/image_str/parse_img.py @@ -38,6 +38,16 @@ class Ocr: def __init__(self, df=None, bag_path=None): + + if "ASTROBEE_CONFIG_DIR" not in os.environ: + raise EnvironmentError(f"ASTROBEE_CONFIG_DIR is not set") + if "ASTROBEE_RESOURCE_DIR" not in os.environ: + raise EnvironmentError(f"ASTROBEE_RESOURCE_DIR is not set") + if "ASTROBEE_ROBOT" not in os.environ: + raise EnvironmentError(f"ASTROBEE_ROBOT is not set") + if "ASTROBEE_WORLD" not in os.environ: + raise EnvironmentError(f"ASTROBEE_WORLD is not set") + self.net = self.__get_craft() self.parseq, self.img_transform = self.__get_parseq() @@ -126,7 +136,7 @@ def parse_folder( "image", "location", ] - final_file = result_folder + "all_locations.csv" + final_file = os.path.join(result_folder, "all_locations.csv") f = open(final_file, "w") writer = csv.writer(f, delimiter=";") writer.writerow(header) @@ -998,15 +1008,6 @@ def __find_image(self, image_file, df, label, display_img): if __name__ == "__main__": warnings.filterwarnings("ignore") - if "ASTROBEE_CONFIG_DIR" not in os.environ: - raise EnvironmentError(f"ASTROBEE_CONFIG_DIR is not set") - if "ASTROBEE_RESOURCE_DIR" not in os.environ: - raise EnvironmentError(f"ASTROBEE_RESOURCE_DIR is not set") - if "ASTROBEE_ROBOT" not in os.environ: - raise EnvironmentError(f"ASTROBEE_ROBOT is not set") - if "ASTROBEE_WORLD" not in os.environ: - raise EnvironmentError(f"ASTROBEE_WORLD is not set") - import argparse parser = argparse.ArgumentParser()