[ python-Bugs-1603412 ] f=open fails with TypeError

SourceForge.net noreply at sourceforge.net
Mon Nov 27 06:28:12 CET 2006


Bugs item #1603412, was opened at 2006-11-26 15:44
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1603412&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Gibholio (gibholio)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: f=open fails with TypeError

Initial Comment:
I've found that Python 2.5 halts, giving a TypeError, when opening a file to write to.  This is the error (path is shortened for compactness):

Traceback (most recent call last):
  File "C:\...\BatchGen.py", line 32, in <module>
    f=open('ImGen.bat', 'w')
TypeError: an integer is required

I noticed that calling an external command via os.system() would always make the error occur, but now it is happening all the time.  I've tried this on two machines, both running Windows XP SP2.

----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2006-11-26 21:28

Message:
Logged In: YES 
user_id=33168
Originator: NO

This isn't a bug.  The problem is that you are doing:  from os import *
which shadows the builtin open.  os.open() has a different signature.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1603412&group_id=5470


More information about the Python-bugs-list mailing list