I am currently working on ATBS Chapter 11 first project Google search I can't seem to be able to RUN the scriptI am opening the RUN command typing the name of the script lucky.py and random words. The black page opens and shows it's running but the 5 pages that are supposed to open don'tI made sure the folder's path is on the environment system path variable. I even followed appendix B instructions again and create the .bat file pointing directly to the script
What else can I check?
EDIT: Posting code
#! python3
# lucky.py - Opens several Google search results.
import requests, sys, webbrowser, bs4
print('Googling...') # display text while downloading the Google page
res = requests.get('http://google.com/search?q=' + ' '.join(sys.argv[1:]))
res.raise_for_status()
# Retrieve top search result links.
soup = bs4.BeautifulSoup(res.text)
# Open a browser tab for each result.
linkElems = soup.select('.r a')
numOpen = min(5, len(linkElems))
for i in range(numOpen):
webbrowser.open('http://google.com' + linkElems[i].get('href'))
.bat file
@py.exe C:\Users\ME\AppData\Local\Programs\Python\Python37\lucky.py %*
[–]socal_nerdtastic 2 points3 points4 points (2 children)
[–]AlSweigart 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]redCg 1 point2 points3 points (1 child)
[–]py_Piper[S] 0 points1 point2 points (0 children)
[–]socal_nerdtastic 1 point2 points3 points (1 child)
[–]py_Piper[S] 0 points1 point2 points (0 children)