WindowsでSelenium+PhantomJS@Pythonでエラー

WindowsPythonseleniumしてみたらエラーが出た。

Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.phantomjs.service.Service object at 0x00000000023B4CF8>>
Traceback (most recent call last):
File "D:\Miniconda3\envs\myenv3\lib\site-packages\selenium\webdriver\common\service.py", line 136, in __del__

File "D:\Miniconda3\envs\myenv3\lib\site-packages\selenium\webdriver\common\service.py", line 124, in stop
AttributeError: 'NoneType' object has no attribute 'close'

Serviceクラスのstopメソッドでプロセス停止のため(?)のself.process.stdout.close()が実行されている? しかしself.process.stdoutがNoneになっている?

部分的に抜粋

    def __init__(self, executable, port=0, log_file=PIPE, env=None, start_error_message=""):
        self.log_file = log_file


    def start(self):
        try:
            self.process = subprocess.Popen(cmd, env=self.env,
                                            close_fds=platform.system() != 'Windows',
                                            stdout=self.log_file, stderr=self.log_file)
    def stop(self):
        try:
            if self.process:
                self.process.stdout.close()

大丈夫そうに見えるんだがなあ

17.1. subprocess — サブプロセス管理 — Python 2.7.x ドキュメント
この辺に「Windowsのみ~」みたいな文言が散見される。関係あるかも。

バージョン 3.3 で追加.

Popen.stdin
If the stdin argument was PIPE, this attribute is a writeable stream object as returned by open(). If the universal_newlines argument was True, the stream is a text stream, otherwise it is a byte stream. If the stdin argument was not PIPE, this attribute is None.

Popen.stdout
If the stdout argument was PIPE, this attribute is a readable stream object as returned by open(). Reading from the stream provides output from the child process. If the universal_newlines argument was True, the stream is a text stream, otherwise it is a byte stream. If the stdout argument was not PIPE, this attribute is None.

Popen.stderr
If the stderr argument was PIPE, this attribute is a readable stream object as returned by open(). Reading from the stream provides error output from the child process. If the universal_newlines argument was True, the stream is a text stream, otherwise it is a byte stream. If the stderr argument was not PIPE, this attribute is None.

stdoutにPIPEを指定していればNoneにはならない筈...
一旦self.log_fileに入れてるのがまずいのかな?

            self.process = subprocess.Popen(cmd, env=self.env,
                                            close_fds=platform.system() != 'Windows',
-                                            stdout=self.log_file, stderr=self.log_file)
+                                            stdout=PIPE, stderr=PIPE)

はっきりPIPEと書いたらエラーしなくなった。Windowsseleniumはこういうもの?