'Blender import python module

I am running Blender 2.49 with Python27 (for testing) and am trying to import webbrowser and os. When I try webbrowser the console returns "no module named webbrowser" when I try os it returns "no module named genericpath". This is extremely annoying as I've looked at various forums on how to do things such as adding the module to Blenders script path and what not, but nothing has worked. I would greatly appreciate any help.

Thanks, Alex



Solution 1:[1]

When you try to do so in Blender 2.71 it will work as follows :

import webbrowser
import os

Solution 2:[2]

The only way I've found to install 3rd party modules is to open Blender and run the following commands in the integrated python terminal.

from pip._internal import main
main(['install','webbrowser'])

This will install whatever 3rd party module to your python version in Blender. Maybe it won't work for the legacy version of Blender, but it works on the newest one. I hope it helps.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 orbatschow
Solution 2 Dumb Explaination