Hi Alan/Danny/Steve,

Thank you very much, I'm able to get the script working.


-Regards,
Anirudh Tamsekar


On Tue, Aug 26, 2014 at 10:25 PM, Alan Gauld <alan.ga...@btinternet.com>
wrote:

> On 26/08/14 10:10, Anirudh Tamsekar wrote:
>
>  *Traceback (most recent call last):*
>> *  File "./rsyslog_check.py", line 22, in <module>*
>> *    difft=cur_time-mt*
>> *TypeError: unsupported operand type(s) for -: 'str' and 'str'*
>>
>>
>> Request your help. Also point any good documentation where I can get
>> quick reference.
>>
>> ct = time.ctime(os.path.getctime(tfile))
>> mt = time.ctime(os.path.getctime(tfile))
>>
>
> You are converting the times to strings before you subtract them. Don't do
> that, subtract the times as returned by os.path.getctime() and time.time().
>
>  cur_time = time.ctime()
>> difft=int(cur_time-mt)
>>
>
> You need to subtract the numeric versions of the times not the strings.
>
> The best quick references are the dir() and help() builtin functions.
> For more detail read the documentation for time, os.path (and maybe
> datetime) modules.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.flickr.com/photos/alangauldphotos
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to