[IronPython] file.mode property doesn't exist

William Reade william at resolversystems.com
Thu Mar 6 12:01:59 CET 2008

IronPython 1.1.1 (1.1.1) on .NET 2.0.50727.312
Copyright (c) Microsoft Corporation. All rights reserved.
 >>> f = open("text.txt")
 >>> f.mode
Traceback (most recent call last):
  File , line 0, in <stdin>##82
AttributeError: 'file' object has no attribute 'mode'

Would it be possible to implement this property? I'm trying to implement 
PyFile_AsFile for Ironclad, and it would be enormously helpful to be 
able to retrieve a file's mode (for _fdopen in msvcrt.dll) without 
either (1) depending on a custom IronPython or (2) reflecting the real 
IronPython half to death.

For now, I'm just going to assume that all files have been opened for 
reading, so I can get some useful functionality without it; still, I'd 
be very grateful if you would slip this into a nearish-future release 
(or, ofc, tell me what I failed to notice that makes my request 
unnecessary ;-) ).


More information about the Ironpython-users mailing list