Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Help writing to file (http://www.velocityreviews.com/forums/t320063-help-writing-to-file.html)

Stan Cook 07-24-2003 03:33 AM

Help writing to file
 
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'

I get the above message from this section of code:

for s in _image:
_serv = s
print _serv
_ErrorLevel=map_server(_serv)
_log.write(string.ljust( _serv, 25))

_image is a list containing server names.

Any help would be appreciated.

Thanks,

Stan


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/03



Ben Finney 07-24-2003 03:45 AM

Re: Help writing to file
 
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


All times are GMT. The time now is 08:53 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.