Weird Problem

Carl Banks imbosol at aerojockey.invalid
Thu Aug 21 07:23:08 CEST 2003


Kris Caselden wrote:
> I'm sure this is a simple newbie problem, but I can't figure it out
> for the life of me.
> 
> The code:
> import sys, os
> input = open("example.py","r")
> 
> Gives me the error:
> TypeError: an integer is required


I'm going to guess.  I'll bet you used "from os import *" somewhere
above that.  os has a function "open" that closely interfaces the
operating system's open call--and the second argument has to be an
integer.

BTW, you don't know this, but since you're using 2.3, you should
probably start using "file" instead of open:

    input = file("example.py","r")



-- 
CARL BANKS                   http://www.aerojockey.com/software
"You don't run Microsoft Windows.  Microsoft Windows runs you."




More information about the Python-list mailing list