[Tutor] Selecting a browser
ricaraoz at gmail.com
Tue Dec 4 05:45:31 CET 2007
Kent Johnson wrote:
> Ricardo Aráoz wrote:
>>>>> import webbrowser
>>>>> ff = webbrowser.get("S:\FirefoxPortable\FirefoxPortable.exe %s &")
> Beware of backslashes in file paths - backslash introduces a character
> escape in Python strings. You can fix by any of
> - use \\ instead of \
> - use / instead of \ (it works fine)
> - use raw strings (prefix with r) e.g.
> r"S:\FirefoxPortable\FirefoxPortable.exe %s &"
Thanks Kent, that was certainly the problem. So I went through it just
to hit another wall, when issuing the open method :
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "E:\Python25\lib\webbrowser.py", line 168, in open
p = subprocess.Popen(cmdline, close_fds=True)
File "E:\Python25\lib\subprocess.py", line 551, in __init__
raise ValueError("close_fds is not supported on Windows "
ValueError: close_fds is not supported on Windows platforms
No easy way, I'll have to check the module's code. Or go Marty's way
More information about the Tutor