473,395 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Need eyes to look at code... time not having an attribute called asctime()

from utilities import *
from extractor import *
import time
import os

print 'Running AgentPing at '+time.asctime()

confFile = '../conf/AgentPing/AgentPing.conf'
ex = extractor(confFile)

names = ex.array('name')
comments = ex.array('comment')
ips = ex.array('ip')
counts = ex.array('count')
thresholds = ex.array('threshold')
alarms = ex.array('alarm')
levels = ex.array('level')
records = ex.array('record')

plogger = Logger('../logs/AgentPing.log')

for name,comment,count,ip,threshold,alarm,level,record in
zip(names,comments,counts,ips,thresholds,alarms,le vels,records):
msg = 'AGENT INFORMATION: Pinging '+ip+' at '+time.asctime()
print msg
plogger.loggit(msg)
line = 'ping -n '+count+' '+ip
try:
data = os.popen(line).readlines()
time = data[-1].split()[-1][:-2]
except:
msg = 'AGENT FAILURE: Unable to run ping on '+ip+' for unknown
reason.'
print msg
msg += 'Error created at '+time.asctime()
time = float(threshold)*2
plogger.loggit(msg)
createAlarm(name, comment, ip, threshold, level, msg)

Whenever I run this I get:
Traceback (most recent call last):
File "agentPing.py", line 23, in ?
msg = 'AGENT INFORMATION: Pinging '+ip+' at '+time.asctime()
AttributeError: 'str' object has no attribute 'asctime'
Press any key to exit

I'm sure this is something simple but for this I am having trouble
figuring it out.

Thanks,

Harlin Seritt

Dec 5 '05 #1
1 1351
Harlin Seritt wrote:
from utilities import *
from extractor import *
import time .... data = os.popen(line).readlines()
time = data[-1].split()[-1][:-2] This seems an unfortunate choice of names. except:
...


--Scott David Daniels
sc***********@acm.org
Dec 5 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
6
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334,...
5
by: Flzw | last post by:
Is there a standard library (C or C++) to convert a time in seconds since Jan, 1st 1970 into a formatted datetime string ?
9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
30
by: nephish | last post by:
Hey there, i have tried about every graphing package for python i can get to work on my system. gnuplot, pychart, biggles, gdchart, etc.. (cant get matplot to work) so far, they all are working...
17
by: Razzel | last post by:
I created this as a test: #include <time.h> main(){ printf(X1: %s\n", putim()); printf(X2: %s\n", putim()); } putim() { time_t t; time(&t); return(ctime(&t));
5
by: yezi | last post by:
Hi: I am coding to output the result to the tmp file in order to send to the client. The following is the code I write to output the system call to a tmp file "tmp.txt". However, when running it,...
0
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need ...
2
by: Anders B | last post by:
I want to make a program that reads the content of a LUA array save file.. More precicely a save file from a World of Warcraft plugin called CharacterProfiler, which dumps alot of information about...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.