confusion about opening files

Mark McEahern marklists at mceahern.com
Mon Sep 23 22:44:13 EDT 2002


[robie1373]
> 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?

This is a FAQ.  You should probably find the Python FAQ and read it.  Short
story:  Don't use 'from x import *' unless you know what you're doing.

Cheers,

// m

-





More information about the Python-list mailing list