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

NameError: name 'driver' is not defined #13

Closed
jacksaturn opened this issue Aug 11, 2023 · 8 comments · Fixed by #14
Closed

NameError: name 'driver' is not defined #13

jacksaturn opened this issue Aug 11, 2023 · 8 comments · Fixed by #14
Labels

Comments

@jacksaturn
Copy link

jacksaturn commented Aug 11, 2023

Thank you for creating this script!

I have everything installed, but I'm receiving an error when I attempt to execute it:

Exception ignored in atexit callback: <function cleanup_session at 0x7f167c03d480>
Traceback (most recent call last):  
    File "craigslist-renew.py", line 227, in cleanup_session  
        if driver:  
NameError: name 'driver' is not defined

Any thoughts?

@jsetton
Copy link
Owner

jsetton commented Aug 11, 2023

How are you running the script?

@jacksaturn
Copy link
Author

jacksaturn commented Aug 11, 2023

I'm running the script from the command line in Ubuntu.

Prior to that I was receiving an error message about fake_useragent, but it turned out that I didn't have fake_useragent installed. Once installed, I started receiving this error about 'driver'.

I attempted to omit the webdriver path in the logfile, but that didn't correct the error.

@jsetton
Copy link
Owner

jsetton commented Aug 11, 2023

Did you install all the required packages?

pip3 install -r requirements.txt

Keep in mind you will need to have a Selenium webdriver running on your machine for the script to work.

If not, I would suggest to use the Docker image.

@jsetton jsetton added the bug label Aug 11, 2023
@jsetton
Copy link
Owner

jsetton commented Aug 11, 2023

Actually I can replicate this issue on my end. I will look into it.

@jacksaturn
Copy link
Author

Thank you, I appreciate it!

To answer your question, all required packages have been installed.

I also tried entering /usr/lib/chromium-browser/chromedriver as my webdriver path, but no change.

@jsetton
Copy link
Owner

jsetton commented Aug 11, 2023

You should have another error (most likely from the selenium webdriver) prior to the driver error.

@jacksaturn
Copy link
Author

jacksaturn commented Aug 11, 2023

I'd overlooked the first one, but I see it now:

Something went wrong: expected '<document start>', but found '<block mapping start>'
  in "config.yml", line 5, column 1

@jsetton
Copy link
Owner

jsetton commented Aug 11, 2023

I'd overlooked the first one

The driver error is actually irrelevant. I will push a change to ignore it.

As far as being able to replicate this error, I actually had an issue with my Selenium webdriver instance. Once fixed, the script worked fine.

So you should focus on the first error generated. It should be either an issue loading the configuration file or initializing the Selenium webdriver instance in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants