Selenium Webdriver与[Errno 10054] [英] Selenium Webdriver halting with [Errno 10054]

查看:298
本文介绍了Selenium Webdriver与[Errno 10054]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行一个使用Selenium 2.37.2的Python 2.7.0例程来启动Firefox 26.0浏览器,并向Google n-grams站点(全部在我的Windows 8机器上)提交查询。该程序对于输入文件中的前10个条目完美工作,然后停止以下跟踪:

  Traceback(最近的调用最后):
文件C:\Python27\lib\lib-tk\Tkinter.py,行1410,在__call__
返回self.func(* args)
文件C:\ Users \Douglas\Desktop\\\
-grams\\\
_gram_api.py,第43行,在query_n_gra
ms
driver.get(https:// books。 google.com/ngrams)
文件C:\Python27\lib\site-packages\selenium- 2.37.2-py2.7.egg\selenium\webdriv
er \remote\webdriver.py,第176行,得到
self.execute(Command.GET,{'url':url})
文件C:\Python27\lib\\ \\ site-packages \ selenium-2.37.2-py2.7.egg\selenium\webdriv
er\remote\webdriver.py,第162行,执行
response = self .command_executor.execute(driver_command,params)
文件C:\Python27\lib\site- packages \ selenium-2.37.2-py2.7.egg\selenium\webdriv
er\remote\remote_connection.py,第355行,执行
返回self._request(url ,method = command_info [0],data = data)
文件C:\Python27\lib\site-packages\selenium- 2.37.2-py2.7.egg\selenium\webdriv
er\remote\remote_connection.py,第402行,在_request
响应= opener.open(请求)
文件C:\Python27\lib\urllib2。 py,第391行,打开
response = self._open(req,data)
文件C:\Python27\lib\urllib2.py,第409行,在_open
$ _ bn
文件C:\Python27\lib\urllib2.py,行369,在_call_chain
result = func(* args)
文件C:\Python27\lib\urllib2.py,第1173行,在http_open
中返回self.do_open(httplib.HTTPConnection,req)
文件C:\Python27\lib \urllib2.py,第1148行,在do_open
raise UR LError(err)
URLError:< urlopen error [Errno 10054]现有的连接被远程主机强制关闭
d>

我找到了一些讨论错误信息的信息站点,但是我一直无法弄清楚为什么我自己的过程在经过for循环十次之后停止。这里是我正在运行的代码(抱歉有点长,我不想修剪它,以防肇事者被隐藏在GUI中):



<$从selenium导入webdriver
从selenium.webdriver.common.keys导入密钥
从Tkinter导入*
导入Tkinter作为tk
从tkFileDialog import askopenfilename
import time
$ b $ out $ b $ out = open(n_grams_outfile.txt,w)
out.write(search string+ \ t+pub year+\ t+frequency+\\\


#创建一个函数,返回用户提供的文件的文件路径
user_defined_filepath = {
def selectfile():
user_defined_filepath ['filename'] = askopenfilename(filetypes = [(Text,*。txt)])#user_defined_filepath [文件名']现在可以在全局范围内访问。
$ b $ #create函数我们会在按下开始按钮时调用
def query_n_grams(event =< Button>):

#create binary switch we只能用第一遍启动新的浏览器。设置默认值为true
first_pass = 1

#identify输入文件
inputfile = user_defined_filepath ['filename']
readinputfile = open(inputfile).read()
stringinputfile = str(readinputfile)

#assume输入文件= tsv。左边栏= len <= 6的字符串;右栏=文本的年份
split_by_row = stringinputfile.split(\\\

用于split_by_row中的行:
search_terms = row.split(\ t)[ 0]
actual_pub_year = row.split(\ t)[1]
pub_year_minus_five = int(actual_pub_year) - 5
pub_year_plus_five = int(actual_pub_year)+ 5

#你现在有条款和酒吧。如果first_pass == 1:
driver = webdriver.Firefox()
first_pass = 0

#otherwise,使用extant驱动程序
driver.implicitly_wait(10)
driver.get(https://books.google.com/ngrams)
driver.implicitly_wait(10)

#发送密钥
driver.implicitly_wait(10)
keyword = driver.find_element_by_class_name(query)
driver.implicitly_wait(10)
keyword.clear()
driver .implicitly_wait(10)
keyword.send_keys(str(search_terms))
driver.implicitly_wait(10)

#find start year
driver.implicitly_wait(10)
start_year = driver.find_element_by_name(year_start)
driver.implicitly_wait(10)
start_year.clear()
driver.implicitly_wait(10)
start_year.send_keys (str(pub_year_minus_five))
dr iver.implicitly_wait(10)

#find end year
driver.implicitly_wait(10)
end_year = driver.find_element_by_name(year_end)
driver.implicitly_wait 10)
end_year.clear()
driver.implicitly_wait(10)
end_year.send_keys(pub_year_plus_five)
driver.implicitly_wait(10)

#点击输入
driver.implicitly_wait(10)
submit_button = driver.find_element_by_class_name(kd_submit)
driver.implicitly_wait(10)
submit_button.click()
driver .implicitly_wait(10)

#grab html
driver.implicitly_wait(10)
html = driver.page_source
driver.implicitly_wait(10)

#如果你运行的搜索不产生命中,不能拆分的HTML,所以使用尝试/除了
尝试:

#我们希望列表对象后来时间序列和逗号之前
desired_percent_figures = html.split(''timeseries':['] [1] .split(])[0]

#now desired_percent_figures包含以逗号分隔的百分比列表我们仍然需要转换出数学符号)。转换出数学符号(用e)
percents_as_list = desired_percent_figures.split(,)

#转换为整数
percent_list_as_ints = [float(i)为我在percents_as_list ]

#获取您的列表并找到均值
mean_percent = sum(percent_list_as_ints)/ float(len(percent_list_as_ints))

out.write(str(search_terms) +\ t+ str(actual_pub_year)+\ t+ str(mean_percent)+\ n)

#如果您运行一个查询如你好加勒特,根本没有在数据库中的条目。 (其他查询,如1700年的动物经济,得到的结果为0,但由于搜索字符串在其他数据库中,不会抛出IndexError)
除了IndexError:

mean_percent = 0.0

#因为我们有索引错误,我们知道搜索没有结果。 (str(search_terms)+\ t+ str(actual_pub_year)+\ t+ str(mean_percent)+\\\


time.sleep(6)

#create TK frame
root = tk.Tk()
canvas = tk.Canvas(root,width = 157, height = 100)
canvas.pack()

#为tk添加标签
ngram_label = tk.Button(root,text =Google N-Gram API,command = ,anchor ='w',width = 14,activebackground =#33B5E5)
ngram_label_canvas = canvas.create_window(20,20,anchor ='nw',width = 119,window = ngram_label)

#创建一个允许用户查找文件进行分析的按钮
file_label = tk.Button(root,text =Input file,command = selectfile,anchor ='w',width = 7,activebackground =#33B5E5)
file_label_canvas = canvas.create_window(20,60,anchor ='nw',window = file_label)

#创建一个开始按钮,允许用户提交选定的参数并运行开始查看过程s
start_label = tk.Button(root,text =Go!,command = query_n_grams,anchor ='w',width = 3,activebackground =#33B5E5)
start_label_canvas = canvas.create_window (107,60,anchor ='nw',window = start_label)

root.mainloop()

有谁知道为什么这个脚本会产生我上面发布的错误信息?我非常感谢其他人可以提供的关于这个问题的建议。

解决方案

我调用了Firefox 23而不是26,解决了这个问题。

  from selenium import webdriver $ b $ from selenium.webdriver.common.keys import $ Keys $ b $ from Tkinter import * 
从tkFileDialog导入Tkinter为tk
导入askopenfilename
导入时间
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

#out
out = open(n_grams_outfile.txt,w)
out.write(search string+\ t+pub year+\ t+frequency+\\ \\ n)

#创建一个函数,返回用户提供的文件的文件路径
user_defined_filepath = {}
def selectfile():
user_defined_filepath ['filename'] = askopenfilename(filetypes = [(Text,*。txt)])#user_defined_filepath ['filename']现在可以在全局范围内访问。
$ b $ #create函数我们会在按下开始按钮时调用
def query_n_grams(event =< Button>):

#create binary switch we只能用第一遍启动新的浏览器。设置默认值为true
first_pass = 1

#identify输入文件
inputfile = user_defined_filepath ['filename']
readinputfile = open(inputfile).read()
stringinputfile = str(readinputfile)

#assume输入文件= tsv。左边栏= len <= 6的字符串;右栏=文本的年份
split_by_row = stringinputfile.split(\\\

在split_by_row中的行:

#因为如果程序到达输入文件的结尾,然后尝试在\ t分隔一个空行,在try / wrap除外
试试:
search_terms = row.split(\ t)[ 0]
actual_pub_year = row.split(\t)[1]
除了IndexError:
通过

pub_year_minus_five = int(actual_pub_year) - 5
pub_year_plus_five = int(actual_pub_year)+ 5

#你现在有条款和酒吧yaer。打开webdriver和骑牛仔
if first_pass == 1:

binary = FirefoxBinary('C:\Text\Professional\Digital Humanities\Programming Languages\Python\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ QueryQuery \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\QueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQueryQuery b
#其次,使用extant驱动
driver.implicitly_wait(10)
driver.get(https://books.google.com/ngrams)
driver.refresh ()
driver.implicitly_wait(10)

#send keys
driver.implicitly_wait(10)
keyword = driver.find_element_by_class_name(query)
driver.implicitly_wait(10)
keyword.clear()
driver.implicitly_wait(10)
keyword.send_keys(str(search_terms))
driver.implicitly_wait(10)

#fi nd start year
driver.implicitly_wait(10)
start_year = driver.find_element_by_name(year_start)
driver.implicitly_wait(10)
start_year.clear()
driver.implicitly_wait(10)
start_year.send_keys(str(pub_year_minus_five))
driver.implicitly_wait(10)

#find end year
driver.implicitly_wait(10) )
end_year = driver.find_element_by_name(year_end)
driver.implicitly_wait(10)
end_year.clear()
driver.implicitly_wait(10)
end_year。 (10)
driver.implicitly_wait(10)

$ b driver.implicitly_wait(10)
submit_button.click()
driver.implicitly_wait(10)

#grab html
driver.implicitly_wa它(10)
html = driver.page_source
driver.implicitly_wait(10)

#如果您运行的搜索不产生命中,不能拆分的HTML,所以使用try /除了
试试:

#我们需要在时间序列之后和逗号之前出现的列表对象
desired_percent_figures = html.split('timeseries:['' )[1] .split(])[0]

#now desired_percent_figures包含以逗号分隔的百分比列表(我们仍然需要转换出数学符号)。转换出数学符号(用e)
percents_as_list = desired_percent_figures.split(,)

#转换为整数
percent_list_as_ints = [float(i)为我在percents_as_list ]

#获取您的列表并找到平均值
mean_percent = sum(percent_list_as_ints)/ float(len(percent_list_as_ints))

out.write(str(search_terms) +\ t+ str(actual_pub_year)+\ t+ str(mean_percent)+\ n)

#如果您运行一个查询如你好加勒特,根本没有在数据库中的条目。 (其他查询,如1700年的动物经济,得到的结果为0,但由于搜索字符串在其他数据库中,不会抛出IndexError)
除了IndexError:

mean_percent = 0.0

#因为我们有索引错误,我们知道搜索没有结果。 (str(search_terms)+\ t+ str(actual_pub_year)+\ t+ str(mean_percent)+\\\


#create TK frame
root = tk.Tk()
canvas = tk.Canvas(root,width = 157,height = 100)
canvas.pack()

#为tk
创建标签ngram_label = tk.Button(root,text =Google N-Gram API,command =,anchor ='w',width = 14,activebackground =#33B5E5)
ngram_label_canvas = canvas.create_window(20,20,anchor ='nw',width = 119,window = ngram_label)

#创建一个按钮,允许用户找到一个分析文件
file_label = tk.Button(root,text =Input file,command = selectfile,anchor ='w',width = 7,activebackground =#33B5E5)
file_label_canvas = canvas.create_window(20,60,anchor ='nw',window = file_label)

#创建一个启动按钮,允许用户提交选定的参数并运行startviewing进程
start_label = tk.Button(ro ot,text =Go!,command = query_n_grams,anchor ='w',width = 3,activebackground =#33B5E5)
start_label_canvas = canvas.create_window(107,60,anchor ='nw', window = start_label)

root.mainloop()


I am trying to run a Python 2.7.0 routine that uses Selenium 2.37.2 to launch Firefox 26.0 browsers and submit queries to the Google n-grams site (all on my Windows 8 machine). The program works perfectly for the first ten entries in an input file, then halts with the following traceback:

Traceback (most recent call last):
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1410, in __call__
    return self.func(*args)
  File "C:\Users\Douglas\Desktop\n-grams\n_gram_api.py", line 43, in query_n_gra
ms
    driver.get("https://books.google.com/ngrams")
  File "C:\Python27\lib\site-packages\selenium-2.37.2-py2.7.egg\selenium\webdriv
er\remote\webdriver.py", line 176, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Python27\lib\site-packages\selenium-2.37.2-py2.7.egg\selenium\webdriv
er\remote\webdriver.py", line 162, in execute
    response = self.command_executor.execute(driver_command, params)
  File "C:\Python27\lib\site-packages\selenium-2.37.2-py2.7.egg\selenium\webdriv
er\remote\remote_connection.py", line 355, in execute
    return self._request(url, method=command_info[0], data=data)
  File "C:\Python27\lib\site-packages\selenium-2.37.2-py2.7.egg\selenium\webdriv
er\remote\remote_connection.py", line 402, in _request
    response = opener.open(request)
  File "C:\Python27\lib\urllib2.py", line 391, in open
    response = self._open(req, data)
  File "C:\Python27\lib\urllib2.py", line 409, in _open
    '_open', req)
  File "C:\Python27\lib\urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1173, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "C:\Python27\lib\urllib2.py", line 1148, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 10054] An existing connection was forcibly close
d by the remote host>

I found a number of informative sites that discuss the error message, but I haven't been able to figure out why my own process is halting after ten interations through the for loop. Here is the code that I'm running (sorry it's a bit long, I didn't want to trim it, in case the culprit is hidden in the GUI):

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from Tkinter import *
import Tkinter as tk
from tkFileDialog import askopenfilename
import time

#out
out = open("n_grams_outfile.txt", "w")
out.write("search string" + "\t" + "pub year" + "\t" + "frequency" + "\n")

#create a function that will return the filepath for a file provided by the user
user_defined_filepath = {}
def selectfile():
    user_defined_filepath['filename'] = askopenfilename(filetypes=[("Text","*.txt")]) # user_defined_filepath['filename'] may now be accessed in the global scope.

#create function we'll call when start button is pressed
def query_n_grams(event = "<Button>"):

    #create binary switch we'll use to only start new browser in first pass. Set default to true
    first_pass = 1

    #identify the input file
    inputfile = user_defined_filepath['filename']
    readinputfile = open(inputfile).read()
    stringinputfile = str(readinputfile)

    #assume input file = tsv. Left hand column = string of len <= 6; right hand column = pub year of text
    split_by_row = stringinputfile.split("\n")
    for row in split_by_row: 
        search_terms = row.split("\t")[0]
        actual_pub_year = row.split("\t")[1]
        pub_year_minus_five = int(actual_pub_year) - 5
        pub_year_plus_five = int(actual_pub_year) + 5        

        #you now have terms and pub yaer. Fire up webdriver and ride, cowboy
        if first_pass == 1:
            driver = webdriver.Firefox()
            first_pass = 0

        #otherwise, use extant driver
        driver.implicitly_wait(10)
        driver.get("https://books.google.com/ngrams")
        driver.implicitly_wait(10)

        #send keys
        driver.implicitly_wait(10)
        keyword = driver.find_element_by_class_name("query")
        driver.implicitly_wait(10)
        keyword.clear()
        driver.implicitly_wait(10)
        keyword.send_keys(str(search_terms))
        driver.implicitly_wait(10)

        #find start year
        driver.implicitly_wait(10)
        start_year = driver.find_element_by_name("year_start")
        driver.implicitly_wait(10)
        start_year.clear()
        driver.implicitly_wait(10)
        start_year.send_keys(str(pub_year_minus_five))
        driver.implicitly_wait(10)

        #find end year
        driver.implicitly_wait(10)
        end_year = driver.find_element_by_name("year_end")
        driver.implicitly_wait(10)
        end_year.clear()
        driver.implicitly_wait(10)
        end_year.send_keys(pub_year_plus_five)
        driver.implicitly_wait(10)

        #click enter
        driver.implicitly_wait(10)
        submit_button = driver.find_element_by_class_name("kd_submit")
        driver.implicitly_wait(10)
        submit_button.click()
        driver.implicitly_wait(10)

        #grab html
        driver.implicitly_wait(10)
        html = driver.page_source
        driver.implicitly_wait(10)

        #if you run a search that yields no hits, can't split the html, so use try/except
        try:

            #we want the list object that comes right after timeseries and before the comma
            desired_percent_figures = html.split('"timeseries": [')[1].split("]")[0]

            #now desired_percent_figures contains comma-separated list of percents (which we still need to convert out of mathematical notation). Convert out of mathematical notation (with e)
            percents_as_list = desired_percent_figures.split(",")

            #convert to ints
            percent_list_as_ints = [float(i) for i in percents_as_list]

            #take your list and find mean
            mean_percent = sum(percent_list_as_ints) / float(len(percent_list_as_ints))

            out.write(str(search_terms) + "\t" + str(actual_pub_year) + "\t" + str(mean_percent) + "\n")

        #you'll get IndexError if you run a query like "Hello Garrett" for which there are no entries in the database at all. (Other queries, like 'animal oeconomy' for year 1700, yields result 0, but because search string is in database elsewhere, won't throw IndexError)
        except IndexError:

            mean_percent = "0.0"

            #because we got an index error, we know that the search yielded no results. so let's type 0.0 as percent
            out.write(str(search_terms) + "\t" + str(actual_pub_year) + "\t" + str(mean_percent) + "\n")

        time.sleep(6)

#create TK frame
root = tk.Tk()
canvas = tk.Canvas(root, width=157, height=100)
canvas.pack()

#create label for tk
ngram_label = tk.Button(root, text = "Google N-Gram API", command = "", anchor = 'w', width = 14, activebackground = "#33B5E5")
ngram_label_canvas = canvas.create_window(20, 20, anchor='nw', width = 119, window=ngram_label)

#create a button that allows users to find a file for analysis
file_label = tk.Button(root, text = "Input file", command = selectfile, anchor = 'w', width = 7, activebackground = "#33B5E5")
file_label_canvas = canvas.create_window(20, 60, anchor='nw', window=file_label)

#create a start button that allows users to submit selected parameters and run the "startviewing" processes
start_label = tk.Button(root, text = "Go!", command = query_n_grams, anchor = 'w', width = 3, activebackground = "#33B5E5")
start_label_canvas = canvas.create_window(107, 60, anchor='nw', window=start_label)

root.mainloop()

Does anyone know why this script would generate the error message I posted above? I would be very grateful for any advice others can offer on this question.

解决方案

I invoked Firefox 23 instead of 26, and that resolved the issue.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from Tkinter import *
import Tkinter as tk
from tkFileDialog import askopenfilename
import time
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

#out
out = open("n_grams_outfile.txt", "w")
out.write("search string" + "\t" + "pub year" + "\t" + "frequency" + "\n")

#create a function that will return the filepath for a file provided by the user
user_defined_filepath = {}
def selectfile():
    user_defined_filepath['filename'] = askopenfilename(filetypes=[("Text","*.txt")]) # user_defined_filepath['filename'] may now be accessed in the global scope.

#create function we'll call when start button is pressed
def query_n_grams(event = "<Button>"):

    #create binary switch we'll use to only start new browser in first pass. Set default to true
    first_pass = 1

    #identify the input file
    inputfile = user_defined_filepath['filename']
    readinputfile = open(inputfile).read()
    stringinputfile = str(readinputfile)

    #assume input file = tsv. Left hand column = string of len <= 6; right hand column = pub year of text
    split_by_row = stringinputfile.split("\n")
    for row in split_by_row:

        #because the program will yelp if it reaches the end of the input file and then tries to split an empty line on "\t", wrap call in try/except
        try:
            search_terms = row.split("\t")[0]
            actual_pub_year = row.split("\t")[1]
        except IndexError:
            pass

        pub_year_minus_five = int(actual_pub_year) - 5
        pub_year_plus_five = int(actual_pub_year) + 5        

        #you now have terms and pub yaer. Fire up webdriver and ride, cowboy
        if first_pass == 1:

            binary = FirefoxBinary('C:\Text\Professional\Digital Humanities\Programming Languages\Python\Query Literature Online\LION 3.0\Firefox Versions\Firefox23\FirefoxPortable.exe')
            driver = webdriver.Firefox(firefox_binary=binary)

            first_pass = 0

        #otherwise, use extant driver
        driver.implicitly_wait(10)
        driver.get("https://books.google.com/ngrams")
        driver.refresh()
        driver.implicitly_wait(10)

        #send keys
        driver.implicitly_wait(10)
        keyword = driver.find_element_by_class_name("query")
        driver.implicitly_wait(10)
        keyword.clear()
        driver.implicitly_wait(10)
        keyword.send_keys(str(search_terms))
        driver.implicitly_wait(10)

        #find start year
        driver.implicitly_wait(10)
        start_year = driver.find_element_by_name("year_start")
        driver.implicitly_wait(10)
        start_year.clear()
        driver.implicitly_wait(10)
        start_year.send_keys(str(pub_year_minus_five))
        driver.implicitly_wait(10)

        #find end year
        driver.implicitly_wait(10)
        end_year = driver.find_element_by_name("year_end")
        driver.implicitly_wait(10)
        end_year.clear()
        driver.implicitly_wait(10)
        end_year.send_keys(pub_year_plus_five)
        driver.implicitly_wait(10)

        #click enter
        driver.implicitly_wait(10)
        submit_button = driver.find_element_by_class_name("kd_submit")
        driver.implicitly_wait(10)
        submit_button.click()
        driver.implicitly_wait(10)

        #grab html
        driver.implicitly_wait(10)
        html = driver.page_source
        driver.implicitly_wait(10)

        #if you run a search that yields no hits, can't split the html, so use try/except
        try:

            #we want the list object that comes right after timeseries and before the comma
            desired_percent_figures = html.split('"timeseries": [')[1].split("]")[0]

            #now desired_percent_figures contains comma-separated list of percents (which we still need to convert out of mathematical notation). Convert out of mathematical notation (with e)
            percents_as_list = desired_percent_figures.split(",")

            #convert to ints
            percent_list_as_ints = [float(i) for i in percents_as_list]

            #take your list and find mean
            mean_percent = sum(percent_list_as_ints) / float(len(percent_list_as_ints))

            out.write(str(search_terms) + "\t" + str(actual_pub_year) + "\t" + str(mean_percent) + "\n")

        #you'll get IndexError if you run a query like "Hello Garrett" for which there are no entries in the database at all. (Other queries, like 'animal oeconomy' for year 1700, yields result 0, but because search string is in database elsewhere, won't throw IndexError)
        except IndexError:

            mean_percent = "0.0"

            #because we got an index error, we know that the search yielded no results. so let's type 0.0 as percent
            out.write(str(search_terms) + "\t" + str(actual_pub_year) + "\t" + str(mean_percent) + "\n")

#create TK frame
root = tk.Tk()
canvas = tk.Canvas(root, width=157, height=100)
canvas.pack()

#create label for tk
ngram_label = tk.Button(root, text = "Google N-Gram API", command = "", anchor = 'w', width = 14, activebackground = "#33B5E5")
ngram_label_canvas = canvas.create_window(20, 20, anchor='nw', width = 119, window=ngram_label)

#create a button that allows users to find a file for analysis
file_label = tk.Button(root, text = "Input file", command = selectfile, anchor = 'w', width = 7, activebackground = "#33B5E5")
file_label_canvas = canvas.create_window(20, 60, anchor='nw', window=file_label)

#create a start button that allows users to submit selected parameters and run the "startviewing" processes
start_label = tk.Button(root, text = "Go!", command = query_n_grams, anchor = 'w', width = 3, activebackground = "#33B5E5")
start_label_canvas = canvas.create_window(107, 60, anchor='nw', window=start_label)

root.mainloop()

这篇关于Selenium Webdriver与[Errno 10054]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆