python的browser指令写在命令行执行和在脚本中,出现不同的结果?
0
在windows环境中的python3命令行中执行如下三条指令:
>>> from splinter.browser import Browser
>>> b = Browser("firefox")
>>> b.visit("https://www.baidu.com")
执行能成功,但是把这3句写成脚本bigpangzi.py的形式执行就会出错。脚本内容如下:
#-*- coding: utf-8- -*-
from splinter.browser import Browser
b = Browser("firefox")
b.visit("https://www.baidu.com")
错误如下:
C:\Users\Dell>python e:/python/bigpangzi.py
tar -zcvf /tmpbak\20170807.zip /tmp/*
'tar' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
Failed
Traceback (most recent call last):
File "e:/python/bigpangzi.py", line 6, in <module>
b = Browser("firefox")
File "C:\Users\Dell\AppData\Local\Programs\Python\Python35-32\lib\site-packages\splinter-0.7.6-py3.5.egg\splinter\browser.py", line 63, in Browser
File "C:\Users\Dell\AppData\Local\Programs\Python\Python35-32\lib\site-packages\splinter-0.7.6-py3.5.egg\splinter\driver\webdriver\firefox.py", line 24, in __init__
File "C:\Users\Dell\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium-3.4.3-py3.5.egg\selenium\webdriver\firefox\firefox_profile.py", line 67, in __init__
self.default_preferences = copy.deepcopy(
AttributeError: module 'copy' has no attribute 'deepcopy'
求大神解答。
>>> from splinter.browser import Browser
>>> b = Browser("firefox")
>>> b.visit("https://www.baidu.com")
执行能成功,但是把这3句写成脚本bigpangzi.py的形式执行就会出错。脚本内容如下:
#-*- coding: utf-8- -*-
from splinter.browser import Browser
b = Browser("firefox")
b.visit("https://www.baidu.com")
错误如下:
C:\Users\Dell>python e:/python/bigpangzi.py
tar -zcvf /tmpbak\20170807.zip /tmp/*
'tar' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
Failed
Traceback (most recent call last):
File "e:/python/bigpangzi.py", line 6, in <module>
b = Browser("firefox")
File "C:\Users\Dell\AppData\Local\Programs\Python\Python35-32\lib\site-packages\splinter-0.7.6-py3.5.egg\splinter\browser.py", line 63, in Browser
File "C:\Users\Dell\AppData\Local\Programs\Python\Python35-32\lib\site-packages\splinter-0.7.6-py3.5.egg\splinter\driver\webdriver\firefox.py", line 24, in __init__
File "C:\Users\Dell\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium-3.4.3-py3.5.egg\selenium\webdriver\firefox\firefox_profile.py", line 67, in __init__
self.default_preferences = copy.deepcopy(
AttributeError: module 'copy' has no attribute 'deepcopy'
求大神解答。
没有找到相关结果
重要提示:提问者不能发表回复,可以通过评论与回答者沟通,沟通后可以通过编辑功能完善问题描述,以便后续其他人能够更容易理解问题.
0 个回复