linkedin_scraper icon indicating copy to clipboard operation
linkedin_scraper copied to clipboard

UnboundLocalError: cannot access local variable 'work_times' where it is not associated with a value

Open maxnau89 opened this issue 1 year ago • 4 comments

Hello all,

this seems to be an issue within the person.py:

Traceback (most recent call last): File "/Users/abcd/Documents/GitHub/Linkedin-Notion-Transfer/linkedin3.py", line 155, in person = Person(linkedin_url, about=[], experiences=[], educations=[], driver=driver, close_on_complete=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/linkedin_scraper/person.py", line 64, in init self.scrape(close_on_complete) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/linkedin_scraper/person.py", line 89, in scrape self.scrape_logged_in(close_on_complete=close_on_complete) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/linkedin_scraper/person.py", line 285, in scrape_logged_in self.get_experiences() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/linkedin_scraper/person.py", line 147, in get_experiences times = work_times.split("·")[0].strip() if work_times else "" ^^^^^^^^^^ UnboundLocalError: cannot access local variable 'work_times' where it is not associated with a value

maxnau89 avatar Jul 18 '23 20:07 maxnau89

hey i have this error too! did you manage to find a solution? thanks

georgemccrae avatar Aug 03 '23 17:08 georgemccrae

any updates on this?

itsa-mee-mario avatar Aug 09 '23 10:08 itsa-mee-mario

Hi, tried to solve it but couldnt find any solution. For now I am just use try/except on the part with worktimes because it doesnt matter in my use case. @joeyism any ideas why it is happening? Happens to some accounts, some working fine. I think this one should catch this error

Kiru6ik avatar Aug 16 '23 15:08 Kiru6ik

you can also just add the line work_times, company, location, position_title = "", "","","" above line 130

laols574 avatar Sep 13 '23 17:09 laols574