Ed Leafe wrote: > On Jan 15, 2008, at 3:39 PM, Jeff Johnson wrote: > >> Thank Ed. But it IS a file object so I can pass it to: >> >> cp = ConfigParser.ConfigParser() >> cp.readfp(f) >> >> Right? It appears to work fine. > > If you open it for write, it should be a zero-byte file. You would > normally open the file for read (i.e., no parameter) before passing > it to something that needs to read it.
AFAIK (but test it for yourself at the command line), you either open files read-only or write-only. IOW, if I open a file with 'w', I can write to it but not read from it. I just tried that and got an exception trying to read from it 'bad file descriptor'. If you want to open up a file to write to without first erasing its contents, you use 'w+' mode. Paul -- http://paulmcnett.com _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]
