Running Chrome From Python Subprocess Won't Allow Use of Specified User-Data-Dir

Viewed 189

I am trying to open chrome through a python script using subprocess but it is not allowing me to use a specified user data directory, and thus defaults to my default user data directory. I get a pop up error reading "Google chrome cannot read and write to its data directory".

Code:

if __name__ == '__main__':
    subprocess.run([
        'chrome.exe',
        '--remote-debugging-port=9222',
        '--user-data-dir="C:\\selenum\\ChromeProfile"'
        ])

I am using Windows 10. If I open chrome with git-bash with command...

chrome.exe --remote-debugging-port=9222 --user-data-dir="C:\selenum\ChromeProfile"

...then it works just fine. I'm thinking that this might be a permissions thing when running chrome out of a python script, but not certain.

0 Answers
Related