2
0
I have a short python script that is set as my default browser in the registry. It will choose to launch IE or Firefox based on the URL (Some work sites only function in IE). In the past, I just used a full path to the python installation to launch it, but this recently broke due to a change in the python install location (it is now bundled with our project files, so it may change more frequently). The path should be updated when it moves, so simply depending on the current environment to find python should be sufficient.
This is the old registry command entry:
[HKEY_CLASSES_ROOT\RRBrowserChooserURL\shell\open\command]
@="\"C:\\Python26\\python.exe\" \"C:\\browser_chooser.pyw\" \"%1\""
Here's the best working option I have come up with so far:
[HKEY_CLASSES_ROOT\RRBrowserChooserURL\shell\open\command]
@="\"C:\\Windows\\System32\\cmd.exe\" \"/c\" \"C:\\browser_chooser.pyw\" \"%1\""
However, this briefly pops up the command window when opening a link. I'd like to avoid that.
Without rewriting my script in another language and compiling it into an executable I can reference directly, is there a good way to get this to execute without knowing the path?
I solve the IE problem with Google Chrome Frame - It lets (l)users continue to use IE, but will transparently render a site within IE using the Chrome engine whenever the site asks for it. My websites demand this plugin of my IE users. A clever solution to a horrible problem. – James T Snell – 2012-11-15T23:12:10.567
The python install directory is in PATH, which is why using cmd.exe works. Without a full path to the exe though, it can't be found.
I will try IE tabs when I'm at the office tomorrow. – RabbleRooster – 2012-11-16T03:05:11.553
@RabbleRooster, that's strange because it works for me. I just created a test on my system doing what you are doing and it worked. – Winter Faulk – 2012-11-16T16:49:08.953
What was the syntax that leveraged the PATH? This doesn't work for me: @=""python.exe" "C:\browser_chooser.pyw" "%1"" – RabbleRooster – 2012-11-16T20:32:27.233
@="python.exe "c:\test.py" "%1"" – Winter Faulk – 2012-11-16T22:16:51.887
@Sane Huh. No dice. I even tried to remove the quotes around python.exe in case it made a difference. Thanks for trying that out, though. – RabbleRooster – 2012-11-16T22:50:10.280