Skip to content

Commit

Permalink
Fix issue with Label Studio being None exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Eve-ning committed Jan 8, 2024
1 parent 54e214c commit fb93890
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/frdc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,22 @@
api_key=LABEL_STUDIO_API_KEY,
)
logger.info("Connected to Label Studio.")
try:
logger.info("Attempting to Get Label Studio Project...")
LABEL_STUDIO_CLIENT.get_project(1)
except requests.exceptions.HTTPError:
logger.warning(
f"Could not get main annotation project. "
f"Pulling annotations may not work. "
f"It's possible that your API Key is incorrect, "
f"or somehow your .netrc is preventing you from "
f"accessing the project. "
)
except requests.exceptions.ConnectionError:
logger.warning(
f"Could not connect to Label Studio at {LABEL_STUDIO_URL}. "
f"LABEL_STUDIO_CLIENT will be None."
)
LABEL_STUDIO_CLIENT = None

try:
logger.info("Attempting to Get Label Studio Project...")
LABEL_STUDIO_CLIENT.get_project(1)
except requests.exceptions.HTTPError:
logger.warning(
f"Could not get main annotation project. "
f"Pulling annotations may not work. "
f"It's possible that your API Key is incorrect, "
f"or somehow your .netrc is preventing you from "
f"accessing the project. "
)

0 comments on commit fb93890

Please sign in to comment.