Translator-GO-Endpoint/scripts/python/package_mangement/check_packages.py

18 lines
629 B
Python
Raw Normal View History

import csv
def check_languages_installed(from_code, to_code):
try:
# Assuming the CSV file is named 'languages.csv' and located in the same directory
with open('data/installed_packages.csv', mode='r') as csv_file:
csv_reader = csv.reader(csv_file)
for row in csv_reader:
# Check if the current row matches the criteria
if len(row) >= 2 and row[0] == from_code and row[1] == to_code:
return True
return False
except FileNotFoundError:
return 1
except Exception:
return 1