0

So I am trying to use the selenium webdriver in a python script as follows:

from selenium import webdriver

Now this is all fine and dandy when I do it within the python shell, but if I write it into a script it tells me

Traceback (most recent call last):
  File "c:/Users/gvasquez/Scripts/viaUpdate.py", line 2, in <module>
    from Selenium import webdriver
ModuleNotFoundError: No module named 'selenium'.

Any thoughts? Thanks.

  • did you pip install Selenium? Try some of the troubleshooting steps from [this post](https://stackoverflow.com/questions/31147660/importerror-no-module-named-selenium) – Joseph Rajchwald Nov 26 '19 at 18:38
  • 3
    `from Selenium import webdriver` Capitalization matters. Why are you using a capital `S`? – John Gordon Nov 26 '19 at 18:38
  • @JohnGordon this is good to point out. I grabbed the wrong traceback, as that was an error I had noticed when I first wrote the code. This is the current error with proper capitalization: `Traceback (most recent call last): File "C:\Users\gvasquez\Scripts\viaUpdate.py", line 2, in from selenium import webdriver ModuleNotFoundError: No module named 'selenium'` – Graham Vasquez Nov 26 '19 at 18:41
  • What command do you use to run the Python shell, and what command do you use to run the script? – John Gordon Nov 26 '19 at 18:42
  • @GrahamVasquez please update your question with the correct traceback – wpercy Nov 26 '19 at 18:42
  • @JosephRajchwald Yep, when I run `pip list` I see `selenium 3.141.0` – Graham Vasquez Nov 26 '19 at 18:42
  • @JohnGordon I have added my scripts folder to my path so I just run `viaUpdate.py`. This works for all my other scripts but if you have something I should change I'm game. – Graham Vasquez Nov 26 '19 at 18:46
  • @wpercy Updated questions with correct traceback. – Graham Vasquez Nov 26 '19 at 18:46

1 Answers1

0

Alright so I feel really dumb, but it looks like all I had to do was run it with the python command prior to the filename:

PS C:\User\username\scripts> python viaUpdate.py

instead of PS C:\User\username\scripts> viaUpdate.py

Thanks for the help.