Help writing to file

Ben Finney bignose-hates-spam at and-benfinney-does-too.id.au
Thu Jul 24 05:45:03 CEST 2003


On Thu, 24 Jul 2003 03:33:11 GMT, Stan Cook wrote:
> I'm trying to have my program write to a log file.  I have the idea,
> but I'm getting an error and don't understand why.
> 
> File "D:\AetInstall\aet.py", line 201, in load_progs
>     _log.write(string.ljust( _serv, 25))
> AttributeError: 'str' object has no attribute 'write'

Seems fairly self-explanatory.  You're invoking the 'write' attribute on
an object of type 'str', which has no such attribute.

Likely you've unintentionally assigned a string value to _log at some
point earlier in the code.

-- 
 \     "Demagogue: One who preaches doctrines he knows to be untrue to |
  `\                  men he knows to be idiots."  -- Henry L. Mencken |
_o__)                                                                  |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B




More information about the Python-list mailing list