[Tutor] Module webbrowser.os

Alan Gauld alan.gauld at yahoo.co.uk
Wed Nov 2 05:16:56 EDT 2016


On 02/11/16 06:44, Palanikumar Gopalakrishnan wrote:
> After that i want to experiment with webbrowser.os  module, But dont know
> how to execute it.

webbrowser.os seems to just be a link to the standard os module.
So you should read the docs for os...and use the os module directly.

> So I use dir(webbrowser.os) to find some details. Then i
> tried the following
> 
> webbrowser.os(umask)
> 
> But It retruns the following error
> 
> *Traceback (most recent call last):  File "<stdin>", line 1, in
> <module>NameError: name 'umask' is not defined*

I'm not sure why because it works for me in both Python 2.7 and 3.4.
Which OS are you using? And which Python version?

But note that umask is a function so

webbrowser.os(umask)

returns a function reference. To get the umask value you must
supply one:

webbrowser.os(umask(0x777))

And the returned value will be the current umask() (Which you
should store and  restore when finished with the new umask)

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list