2024-03-13 17:58:13 +00:00
|
|
|
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
|
2024-03-13 20:40:34 +00:00
|
|
|
with open('data/installed_packages.csv', mode='r') as csv_file:
|
2024-03-13 17:58:13 +00:00
|
|
|
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
|
2024-03-13 20:40:34 +00:00
|
|
|
|