Hi
I was making a program that tried to open firefox like this:

exec file('C:\\Program Files\\Mozilla Firefox\\firefox.exe')

but i get an error

exec file('C:\\Program Files\\Mozilla Firefox\\firefox.exe')
  File "C:\Program Files\Mozilla Firefox\firefox.exe", line 1
SyntaxError: Non-ASCII character '\x90' in file C:\Program Files\Mozilla Firefox\firefox.exe on line 1, but no encoding declared; see [url]http://www.python.org/peps/pep-0263.html[/url] for details (firefox.exe, line 1)

does anyone know how to open firefox and perhaps also to direct it so a predetermined website

Recommended Answers

All 3 Replies

Maybe you should try using the webbrowser module!!!!!

import webbrowser
firefox = webbrowser.get('mozilla') # or 'firefox'
firefox.open('http://www.google.com') # any site

Yeah that webbrowser module is great!
i ended up using:

import webbrowser
webbrowser.open('www.google.com')

thanks everyone

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.