Skip to content

Commit

Permalink
env vars check fix
Browse files Browse the repository at this point in the history
  • Loading branch information
marinagmoreira committed Apr 9, 2024
1 parent 686b0f5 commit 02b2f40
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions anomaly/image_str/scripts/image_str/parse_img.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 02b2f40

Please sign in to comment.