SaranyaDevi Ganesan SaranyaDevi Ganesan - 1 year ago 42
Python Question

Single class. TypeError: 'module' object is not callable

def ProcessFailureSignatures(self, directory, report_dir):
for element in os.listdir(directory):
full_path = os.path.join(directory, element)
m = re.match('(\d+)_FAILED_Pass(\d+)_(.+)', element)
......

def GatherTestResults(self):
earliest = time.time() - TEST_RESULTS_MAX_AGE_SECONDS

for element in os.listdir(RESULTS_DIR_PATH):
time_struct = time.strptime(element, "%Y-%m-%d_%H-%M-%S")
time_sse = time.mktime(time_struct)

outdir = os.path.join(REPORT_DIR_PATH, self.accurev_info['Basis'], self.rtl, element)
summary_file = os.path.join(RESULTS_DIR_PATH, element, "summary.txt")
perf_file = os.path.join(RESULTS_DIR_PATH, element, "performance_data.xml")

if os.path.isfile(perf_file) and not self.IsTestComplete(perf_file, element):
continue
if(time_sse > earliest):
if os.path.isfile(perf_file):
self.ProcessTestPerformance(perf_file, element)

if os.path.isfile(summary_file):
self.ProcessTestSummary(summary_file, element)

self.ProcessFailureSignatures(os.path(RESULTS_DIR_PATH, element), outdir)
...........


I get the following error, also when I type self.ProcessFailureSignatures in Python window, the function name doesn't appear. I don't understand why this wont be in the scope of the class. As it is written under class above the calling function.

File "fbe_test_analyze.py", line 621, in GatherTestResults
self.ProcessFailureSignatures(os.path(RESULTS_DIR_PATH, element), outdir)
TypeError: 'module' object is not callable

Answer Source

os.path is a module. You cant call it. Probably you want some function from the module. The list of functions is here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download