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...
Show off your group to the world. Share a photo of your group with us.

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 #106130 of 122067 |
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

Am I missing something? This is straight out of documentation and
tutorials. What could be wrong? I'm using Python 2.3.

I'm still new to Python, and even though it's a simple language, I
encounter seemingly nonsensical problems like these almost every time
I try to do something. Is this kind of behavior normal for Python or
is there some process I'm not following?

-Chris-
--
http://mail.python.org/mailman/listinfo/python-list



Thu Aug 21, 2003 5:09 am

google@...
Send Email Send Email

Forward
Message #106130 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