python - 我如何理解运行此 Python 程序时遇到的错误?
问题描述
我正在尝试运行最新版本的instapy
0.6.2 版。但我不断收到以下错误:
python quickstart.py
InstaPy Version: 0.6.2
._. ._. ._. ._. ._. ._. ._. ._. ._.
Workspace in use: "/Users/amenra/InstaPy"
Traceback (most recent call last):
File "quickstart.py", line 24, in <module>
headless_browser=False)
File "/Users/amenra/.pyenv/versions/3.7.4/lib/python3.7/site-packages/instapy/instapy.py", line 321, in __init__
self.logger,
File "/Users/amenra/.pyenv/versions/3.7.4/lib/python3.7/site-packages/instapy/browser.py", line 114, in set_selenium_local_session
options=firefox_options,
File "/Users/amenra/.pyenv/versions/3.7.4/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
keep_alive=True)
File "/Users/amenra/.pyenv/versions/3.7.4/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/Users/amenra/.pyenv/versions/3.7.4/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/Users/amenra/.pyenv/versions/3.7.4/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/Users/amenra/.pyenv/versions/3.7.4/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities
我在 MacOSX 上运行,我的 Python 版本是 3.7.4。
这是我的quickstart.py
# imports
from instapy import InstaPy
from instapy import smart_run
# login credentials
insta_username = 'instagram_username'
insta_password = 'instagram_password'
comments = [
'Nice shot! @{}',
'I love your profile! @{}',
'Your feed is an inspiration :thumbsup:',
'Just incredible :open_mouth:',
'What camera did you use @{}?',
'Love your posts @{}',
'Looks awesome @{}',
'Getting inspired by you @{}',
':raised_hands: Yes!',
'I can feel your passion @{} :muscle:',
]
# get an InstaPy session!
# set headless_browser=True to run InstaPy in the background
session = InstaPy(username=insta_username,
password=insta_password,
headless_browser=False)
with smart_run(session):
""" Activity flow """
# general settings
session.set_dont_include(["friend1", "friend2", "friend3"])
# activity
session.like_by_tags(["natgeo"], amount=10)
# Joining Engagement Pods
session.set_do_comment(enabled=True, percentage=35)
session.set_comments(comments)
session.join_pods(topic='sports', engagement_mode='no_comments')
解决方案
我找到的解决方案是我需要Firefox
在我的 Mac 上安装。
推荐阅读
- java - 为什么这个递归函数比迭代函数快 3 倍?
- java - Java 数据建模:使用 Map 或 List 建立一对多关系
- node.js - TypeORM 选择所有行但限制为 25
- c# - 如何过滤 IList 子查询 EF Core 2.2
- python-3.x - 如何在python中使用异步io(快速方式)将数据从一个s3存储桶复制到另一个存储桶?
- r - R中的非线性优化 - 非线性约束
- json - 使用角度解析 Json 响应
- windows - 如何使用 CMD 显示没有父路径的纯文件名
- google-app-engine - 对 gcloud 计算区域的查询描述 us-central1 --flatten='quotas[]' --format='csv[no-heading](quotas.metric,quotas.limit,quotas.usage)'
- javascript - 如何在不重新加载页面的情况下手动设置“this.props.history.location.pathname”的值?