joeyism / linkedin_scraper

A library that scrapes Linkedin for user data
GNU General Public License v3.0
1.86k stars 527 forks source link

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

Open maxnau89 opened 11 months ago

maxnau89 commented 11 months ago

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

georgemccrae commented 11 months ago

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

itsa-mee-mario commented 11 months ago

any updates on this?

Kiru6ik commented 10 months ago

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

laols574 commented 10 months ago

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