How to force built-in commands over imported.

Mark Moales mmoales at
Thu Sep 5 16:48:40 CEST 2002


How did you import the os module?  I'm guessing you did:

from os import *

If you just do:

import os

then when you invoke open, you'll be using the builtin function.  Of
course, all of your os function calls will need to be prefixed with
"os.", but you won't have anymore name clashes.


Maurice van de Rijzen wrote:
> Dear all.
> I'm a newbie on the field of python, therefore the answer to my question
> may be simple.
> There is a built-in commans called open(fileName). There is also a
> open() command in the os-module open which needs more than the fileName.
>   Originally I didn't import the os-module and everything worked fine.
> However, when I imported the os-module I received an error that open
> needed more arguments. How can I force to take the built-in open()
> instead of the open() in the os-module.
> Gr,
> Maurice
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mmoales.vcf
Type: text/x-vcard
Size: 281 bytes
Desc: Card for Mark Moales
URL: <>

More information about the Python-list mailing list