python - 运行 python selenium 代码时在 Heroku cli 中显示类型错误
问题描述
我正在尝试在 Heroku 中运行 selenium 脚本以打开多个 URL 并从那里抓取数据。它在我当地运行良好。但是当我尝试从 Heroku 运行我的脚本时,我得到了以下错误。我正在使用 Heroku-CLI 仅运行一个文件。[使用的命令:python“folder_name/filename.py”]:
'''
Traceback (most recent call last):
File "script/case.py", line 72, in <module>
df_cases=get_cases(driver=initialize_driver())
File "script/case.py", line 19, in initialize_driver
driver=webdriver.Chrome(executable_path=os.environ.get("CHROME_DRIVER_PATH"),options=chrome_options)
File "/app/.heroku/python/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/app/.heroku/python/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "/app/.heroku/python/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/app/.heroku/python/lib/python3.8/subprocess.py", line 1585, in _execute_child
and os.path.dirname(executable)
File "/app/.heroku/python/lib/python3.8/posixpath.py", line 152, in dirname
p = os.fspath(p)
TypeError: expected str, bytes, or os.PathLike object, not NoneType
'''
我无法理解此类错误的原因。我在这里想念什么。
解决方案
推荐阅读
- python - 如何在没有列表理解的情况下从熊猫数据框中删除 HTML
- octave - Octave - 如何绘制“无限”(= 为我在 [0:35916] 上定义函数)锯齿函数
- node.js - 如何使用 Firebase admin sdk 更新 Firestore 中的用户列表?
- docker - docker-compose up 命令在运行完成时返回代码始终为零
- excel - 从一长串文本中提取文本
- java - 以声明方式启动 OSGi 捆绑包时“无法转换为 org.osgi.framework.BundleActivator”
- php - index.php 页面不适用于共享托管中的超薄框架 api
- http - 设置与聚合一起使用的 HTTP 输出标头参数
- sql - SQL:连接条件中的 ISNULL
- python - Django - Site.objects.get_current().domain 返回 example.com