From 745fe068fbb353de62fdcc3e80e68bcd1b5fcc81 Mon Sep 17 00:00:00 2001 From: Maor Friedman Date: Wed, 18 Oct 2023 13:01:01 +0300 Subject: [PATCH] set default values for Person attributes this commit adds a default value (empty string) to some locally defined variables, to allow them to be used in a global context. this handles the following error: ``` UnboundLocalError: cannot access local variable '<>' where it is not associated with a value --- linkedin_scraper/person.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linkedin_scraper/person.py b/linkedin_scraper/person.py index 86d169e..1a324d6 100644 --- a/linkedin_scraper/person.py +++ b/linkedin_scraper/person.py @@ -127,6 +127,8 @@ def get_experiences(self): position_summary_text = position_details_list[1] if len(position_details_list) > 1 else None outer_positions = position_summary_details.find_element(By.XPATH,"*").find_elements(By.XPATH,"*") + company = "" + work_times = "" if len(outer_positions) == 4: position_title = outer_positions[0].find_element(By.TAG_NAME,"span").text company = outer_positions[1].find_element(By.TAG_NAME,"span").text