-2
I created a tool (python 3.7) a while ago using the library Googlesearch and worked normally, I decided to use it today and noticed that is giving problem in the library.
Code:
from googlesearch import search
print(
"""
banner
"""
)
# Pegar tipo de conteúdo
print("Exemplos de conteúdo: Hacking, Forum, eBooks")
conteudo = str(input("Conteúdo:"))
# Dork para encontrar os URLS/LINKS/SITES
dork = f'{conteudo} site:onion.link | site:onion.cab | site:onion.sh | site:tor2web.fi | site:onion.direct'
# Menu de escolhas/seleção
def menu():
banner = '''
+-------------------------------------------------------+
'''
print(banner)
def escolha():
print("0. Sair")
print("1. Sites Onion")
print("2. Créditos")
menu()
while True:
escolha()
menuzinho = int(input("Selecione uma opção: "))
if menuzinho == 0:
print("Até a proxima")
break
elif menuzinho == 1:
with open("site.txt", "w") as stream:
for url in search(dork, stop=50 or 1):
print(url, file=stream)
print("-----------------------------------------------------")
print("Os links foram salvos no seguinte txt: site.txt")
print("-----------------------------------------------------")
elif menuzinho == 2:
print("")
print("Criado por")
print("")
input("Pressione ENTER para continuar")
else:
print("Essa opção não existe, tente novamente!")
you should, in the meantime, have created a file with the name "Googlesearch.py" in the same directory as your test program. Python then imports your file instead of the library.
– jsbueno
How do I fix it?
– user160936
change the name of the file named identical to the library name to another one. Otherwise, the search done by Python during the command
import
will always find this file first and skip the library.– jsbueno
However, it doesn’t seem to be your case - the error you pasted indicates that Python is taking the correct library file.
– jsbueno