2

This is my script (it's the example you can find at https://github.com/ultrafunkamsterdam/undetected-chromedriver):

import undetected_chromedriver as uc
driver = uc.Chrome()
driver.get('https://nowsecure.nl')

I get this error:

RuntimeError       (note: full exception trace is shown but execution is paused at: <module>)

        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.   File "D:\Users\Mark\python scripts\test_2.py", line 2, in <module> (Current frame)
    driver = uc.Chrome()   File "<string>", line 1, in <module>

How do I solve this?

Floppy88
  • 1,031
  • 3
  • 13
  • 31
  • I'm not sure if this is relevant but is this the same error as [here](https://stackoverflow.com/questions/18204782/runtimeerror-on-windows-trying-python-multiprocessing)? – Cmd858 Dec 26 '21 at 14:32
  • @CmdCoder858 Yes, it appears to be the same. However, I think it's generated by the module, and not by my code. – Floppy88 Dec 26 '21 at 18:07
  • 1
    Ok so I don't have a chromedriver executable but I tested the code and adding `if __name__ == "__main__":` around the main code block makes the error change so this might be the fix you are looking for. Also, it seems even the examples in the README file fail without this so it might be a good idea to raise an issue so this can be updated. – Cmd858 Dec 26 '21 at 18:35

1 Answers1

4

try to add param <use_subprocess>:

driver = uc.Chrome(use_subprocess=True)

was found at https://github.com/ultrafunkamsterdam/undetected-chromedriver/issues/384

cottontail
  • 10,268
  • 18
  • 50
  • 51