Search the web
Sign In
New User? Sign Up
python-list · Python List
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Weird Problem   Message List  
Reply | Forward Message #106136 of 122067 |
Re: Weird Problem

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."
--
http://mail.python.org/mailman/listinfo/python-list



Thu Aug 21, 2003 12:23 pm

imbosol@...
Send Email Send Email

Forward
Message #106136 of 122067 |
Expand Messages Author Sort by Date

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...
Kris Caselden
google@...
Send Email
Aug 21, 2003
5:13 am

... 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...
Carl Banks
imbosol@...
Send Email
Aug 21, 2003
5:56 am

... Something I rather don't like given how much old code I have which uses 'file' as a variable. Ditto for quite a few pieces of the standard library. Andrew...
Andrew Dalke
adalke@...
Send Email
Aug 21, 2003
6:14 am

... Always post the actual code, and the *full* traceback, and don't just retype it: cut and paste. -- http://mail.python.org/mailman/listinfo/python-list...
Peter Hansen
peter@...
Send Email
Aug 21, 2003
3:30 pm

Dont forget that 'input' is a keyword in python. It is used to accept user inputs as illustrated below. r=input("Write your name here: ") print r Maybe the...
Anand Pillai
pythonguy@...
Send Email
Aug 21, 2003
6:34 pm

Anand> Dont forget that 'input' is a keyword in python. Not quite. It's the name of a builtin function which almost nobody uses. Anand> It is used to accept...
Skip Montanaro
skip@...
Send Email
Aug 22, 2003
2:59 am

Actually, the problem turned out to be a combination of previously having used "from os import *" along with not having reloaded the code in Pythonwin. Thanks...
Kris Caselden
google@...
Send Email
Aug 22, 2003
7:32 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help