質問編集履歴
2
エラーの出方が変わったので更新しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
pythonを用いてウェブスクレイピングの自動化を試みています。WindowsにDockerを使った環境構築をしてJupyter Labを使っています。
|
3
3
|
今のところ書いているコードは以下の通りです
|
4
4
|
|
5
|
-
|
5
|
+
```python
|
6
6
|
!pip install selenium
|
7
7
|
!pip install beautifulsoup4
|
8
8
|
from selenium import webdriver
|
@@ -12,7 +12,7 @@
|
|
12
12
|
PASS="test_pw"
|
13
13
|
browser=webdriver.Chrome(executable_path='MyPandas/chromedriver.exe')
|
14
14
|
browser.implicitly_wait(3)
|
15
|
-
|
15
|
+
```
|
16
16
|
---
|
17
17
|
|
18
18
|
また、Dockerの中にMyPandas その中にchromedriver というファイルがあります。
|
@@ -25,11 +25,34 @@
|
|
25
25
|
```
|
26
26
|
browser=webdriver.Chrome(executable_path='MyPandas/chromedriver.exe')
|
27
27
|
browser.implicitly_wait(3)
|
28
|
+
```
|
28
29
|
という部分を実行したところ、下記のようなエラーが出ました。
|
29
30
|
---------------------------------------------------------------------------
|
31
|
+
```
|
32
|
+
---------------------------------------------------------------------------
|
33
|
+
FileNotFoundError Traceback (most recent call last)
|
34
|
+
~/anaconda3/lib/python3.7/site-packages/selenium/webdriver/common/service.py in start(self)
|
35
|
+
75 stderr=self.log_file,
|
36
|
+
---> 76 stdin=PIPE)
|
37
|
+
77 except TypeError:
|
38
|
+
|
39
|
+
~/anaconda3/lib/python3.7/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
|
40
|
+
774 errread, errwrite,
|
41
|
+
--> 775 restore_signals, start_new_session)
|
42
|
+
776 except:
|
43
|
+
|
44
|
+
~/anaconda3/lib/python3.7/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
|
45
|
+
1521 err_msg += ': ' + repr(err_filename)
|
46
|
+
-> 1522 raise child_exception_type(errno_num, err_msg, err_filename)
|
47
|
+
1523 raise child_exception_type(err_msg)
|
48
|
+
|
49
|
+
FileNotFoundError: [Errno 2] No such file or directory: 'MyPandas\chromedriver': 'MyPandas\chromedriver'
|
50
|
+
|
51
|
+
During handling of the above exception, another exception occurred:
|
52
|
+
|
30
53
|
WebDriverException Traceback (most recent call last)
|
31
|
-
<ipython-input-
|
54
|
+
<ipython-input-24-ba30553601fa> in <module>
|
32
|
-
----> 1 browser=webdriver.Chrome(executable_path='MyPandas
|
55
|
+
----> 1 browser=webdriver.Chrome(executable_path='MyPandas\chromedriver')
|
33
56
|
2 browser.implicitly_wait(3)
|
34
57
|
|
35
58
|
~/anaconda3/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py in __init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, keep_alive)
|
@@ -40,21 +63,13 @@
|
|
40
63
|
75 try:
|
41
64
|
|
42
65
|
~/anaconda3/lib/python3.7/site-packages/selenium/webdriver/common/service.py in start(self)
|
43
|
-
96 count = 0
|
44
|
-
97 while True:
|
45
|
-
---> 98 self.assert_process_still_running()
|
46
|
-
|
66
|
+
81 raise WebDriverException(
|
67
|
+
82 "'%s' executable needs to be in PATH. %s" % (
|
68
|
+
---> 83 os.path.basename(self.path), self.start_error_message)
|
47
|
-
|
69
|
+
84 )
|
70
|
+
85 elif err.errno == errno.EACCES:
|
48
71
|
|
49
|
-
~/anaconda3/lib/python3.7/site-packages/selenium/webdriver/common/service.py in assert_process_still_running(self)
|
50
|
-
109 raise WebDriverException(
|
51
|
-
110 'Service %s unexpectedly exited. Status code was: %s'
|
52
|
-
--> 111 % (self.path, return_code)
|
53
|
-
112 )
|
54
|
-
113
|
55
|
-
|
56
|
-
WebDriverException: Message:
|
72
|
+
WebDriverException: Message: 'MyPandas\chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
|
57
|
-
|
58
73
|
```
|
59
74
|
|
60
75
|
### 該当のソースコード
|
1
誤字を直した
title
CHANGED
File without changes
|
body
CHANGED
@@ -65,7 +65,7 @@
|
|
65
65
|
```
|
66
66
|
|
67
67
|
### 試したこと
|
68
|
-
ファイルのパスの名前が間違っていいるのではないかと考え確認しました。しかしながらファイル名の記述法は、Dockerにおいてあるファイルなので
|
68
|
+
ファイルのパスの名前が間違っていいるのではないかと考え確認しました。しかしながらファイル名の記述法は、Dockerにおいてあるファイルなのでこれで正しいのではないかと思います。
|
69
69
|
エラー名をコピーしてインターネットで検索をかけたのですが、何が原因でこうなっているのか知識に乏しい私に情報をかみ砕いて理解することが出来ませんでした。
|
70
70
|
|
71
71
|
### 補足情報(FW/ツールのバージョンなど)
|