I am trying to open a file, >>> import os >>> file = os.open("e:\\d12", "r") Traceback (most recent call last): File "<pyshell#4>", line 1, in ? file = os.open("e:\\d12", "r") TypeError: an integer is required I get this error if the mode is r, r+, a+ or whatever. I also get it whether the file exists or not. Can someone explain what I am doing wrong?