1

I included the os module into my program and now the standard file open() call is being occluded by os.open(), is there a way to reference a specific namespace ?

John Sohn
  • 100
  • 1
  • 9

1 Answers1

2

The solution: don't do things like this:

from os import *

Instead, do this:

import os

Then, you can reference the os open function like this:

os.open(something)

And the built-in open as open(filename). If, however, something is shadowing a built-in function:

import builtins
builtins.open(filename)
pigrammer
  • 2,603
  • 1
  • 11
  • 24