Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing #272 folder not found error #284

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions run_first.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@

init_logging_config()

PROCESSED_RESUMES_PATH = "Data/Processed/Resumes"
PROCESSED_JOB_DESCRIPTIONS_PATH = "Data/Processed/JobDescription"
script_dir = os.path.dirname(os.path.abspath(__file__))
PROCESSED_DATA_PATH = os.path.join(script_dir, "Data", "Processed")
PROCESSED_RESUMES_PATH = os.path.join(PROCESSED_DATA_PATH, "Resumes")
PROCESSED_JOB_DESCRIPTIONS_PATH = os.path.join(
PROCESSED_DATA_PATH, "JobDescription"
)

# check if processed data directory exists
if not os.path.exists(PROCESSED_DATA_PATH):
os.makedirs(PROCESSED_DATA_PATH)
os.makedirs(PROCESSED_RESUMES_PATH)
os.makedirs(PROCESSED_JOB_DESCRIPTIONS_PATH)
logging.info("Created necessary directories.")


def read_json(filename):
Expand Down Expand Up @@ -39,11 +50,13 @@ def remove_old_files(files_path):

file_names = get_filenames_from_dir("Data/Resumes")
logging.info("Reading from Data/Resumes is now complete.")
except:
except Exception:
# Exit the program if there are no resumes.
logging.error("There are no resumes present in the specified folder.")
logging.error("Exiting from the program.")
logging.error("Please add resumes in the Data/Resumes folder and try again.")
logging.error(
"Please add resumes in the Data/Resumes folder and try again."
)
exit(1)

# Now after getting the file_names parse the resumes into a JSON Format.
Expand All @@ -61,11 +74,15 @@ def remove_old_files(files_path):

file_names = get_filenames_from_dir("Data/JobDescription")
logging.info("Reading from Data/JobDescription is now complete.")
except:
except Exception:
# Exit the program if there are no resumes.
logging.error("There are no job-description present in the specified folder.")
logging.error(
"There are no job-description present in the specified folder."
)
logging.error("Exiting from the program.")
logging.error("Please add resumes in the Data/JobDescription folder and try again.")
logging.error(
"Please add resumes in the Data/JobDescription folder and try again."
)
exit(1)

# Now after getting the file_names parse the resumes into a JSON Format.
Expand Down