-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Actually there seems something wrong using threading.threads and mp.processes, as well as asyncio or even in the main thread
when creating multiple drivers.
I don't know why i even bother since creating multiple drivers is useless and solves no problems.
chromedriver is just a messaging proxy passing messages back and forth. and 1 driver can control dozens of windows, each containing a magnitude of tabs (and is designed for that)
that having said
note: all the below has also been done using the (use_subprocess=True)
in Ipython this works fine:
drivers = [uc.Chrome() for _ in range(20) ]
however, when creating a file:
...
stuff
...
some other stuff
...
if __name__ == '__main__':
drivers = [uc.Chrome() for _ in range(10)]
input("press a key to exit")
running this file yields:
browser = subprocess.Popen(
File "C:\ProgramData\Python39-32\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\ProgramData\Python39-32\lib\subprocess.py", line 1360, in _execute_child
args = list2cmdline(args)
File "C:\ProgramData\Python39-32\lib\subprocess.py", line 565, in list2cmdline
for arg in map(os.fsdecode, seq):
File "C:\ProgramData\Python39-32\lib\os.py", line 822, in fsdecode
filename = fspath(filename) # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not NoneType
thinking of a solution i tried modifying the code to put the path in a class variable when the first instance starts. but of course this won't work as it is not thread-safe.
workaround
So the ONLY solution for now (which is a bit cumbersome, so actually fits perfectly in creating multiple chromedrivers ;))
but does the job i :
putting the full path to your chrome BROWSER executable in the constructor
like so
drivers = [uc.Chrome(browser_executable_path=r"c:\program files\x\y\z\chrome.exe") for _ in range(135)]
Raising this as an issue since that is hip
(and I don't yet started documentation, nor know where to start, nor have time). so this is FYI