I am creating a program in python 3 and i would like the user to open a URL with a specified web browser application.I have tried using the subprocess.Popen([application, URL]) but it raises a FileNotFoundError.
Any help is greatly appreciated.
EDIT: I forgot to mention that I am using Windows 10, and here is a copy of the Error message I am getting:
Traceback (most recent call last):
File "C:\Users\[Name]\Desktop\AI.py", line 221, in <module>
subprocess.Popen(["google-chrome", "www.google.co.uk/"])
File "C:\Python34\lib\subprocess.py", line 859, in __init__
restore_signals, start_new_session)
File "C:\Python34\lib\subprocess.py", line 1112, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
EDIT2:
This is my result if i try running subprocess.Popen(["start", "chrome", "www.example.com/"]) (and i get the same error if i leave out the "start", part of the array):
`Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
subprocess.Popen(["start", "chrome", "http://www.google.co.uk/"])
File "C:\Python34\lib\subprocess.py", line 859, in __init__ restore_signals, start_new_session)
File "C:\Python34\lib\subprocess.py", line 1112, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified`
subprocess.Popen(["google-chrome", "http://example.com/"])on Ubuntu and it works fine.chrome.exefrom the command-line without Python? Otherwise there may some problem with yourPATH. Try to givePopenthe full path of chrome (driver letter and folders) and see if that works.