Is BikeMike's csv import to User Code List included in this version or will it still be an plug-in? I _LIKE_ this one and can see a BIG use for it.
That's exactly what I was hoping for. ("download or upload individual ccode tables to csv via the GUI. ")
Harold.
tofilename = botslib.abspathdata(str(ta_to.idta))
botslib.dirshouldbethere(os.path.dirname(tofilename)) # self.session.get will not create new data dirs!
self.session.get(fromfilename,tofilename)
tofilename = str(ta_to.idta)
fromfile = self.session.open(fromfilename, 'r') # SSH treats all files as binary
content = fromfile.read()
filesize = len(content)
tofile = botslib.opendata(tofilename, 'wb')
tofile.write(content)
tofile.close()
fromfile.close() tofilename = botslib.abspathdata(str(ta_to.idta))
botslib.dirshouldbethere(os.path.dirname(tofilename)) # self.session.get will not create new data dirs!
self.session.get(fromfilename,tofilename)
filesize = os.path.getsize(tofilename)
botsglobal.logger.info(reporttext)
# sendreportifprocesserror allows blocking of email reports for process errors
if (results['lasterror'] or results['lastopen'] or results['lastok'] or
(results['processerrors'] and botsglobal.ini.getboolean('settings','sendreportifprocesserror',True))):
# Include error details in the email report (if debug is True this will include trace too!)
reporttext += '\n\n'
for filereport in botslib.query('''SELECT errortext
FROM filereport
WHERE reportidta>=%(rootidtaofrun)s''',
{'rootidtaofrun':rootidtaofrun}):
reporttext += filereport['errortext']
botslib.sendbotserrorreport(subject,reporttext)
return int(results['status']) #return report status: 0 (no error) or 1 (error)
# Include error details in the email report (if debug is True this will include trace too!)
reporttext += '\n\n'
for filereport in botslib.query('''SELECT idroute,frompartner,fromchannel,topartner,tochannel,errortext
FROM filereport
WHERE reportidta>=%(rootidtaofrun)s''',
{'rootidtaofrun':rootidtaofrun}):
for field in filereport.keys():
reporttext += '%s: %s\n' % (field,filereport[field])
# Include error details in the email report (if debug is True this will include trace too!)
reporttext += '\n\n' for row in botslib.query('''SELECT idroute,frompartner,fromchannel,topartner,tochannel,errortext
FROM ta
WHERE errortext > ""
AND idta>=%(rootidtaofrun)s''',
{'rootidtaofrun':rootidtaofrun}):
for field in row.keys():
reporttext += '%s: %s\n' % (field,row[field])
- for incoming channels: do not generate error-report communication failures unless communication failed for eg 5 times.
- for outgoing files: do not generate error-report unless outgoing file is retried eg 5 times. (is now: report for each failed communication)
ignore_errors=True but for zips any error stops the whole cleanup process.def _cleanarchive():
''' delete all archive directories older than maxdaysarchive days. Errors are ignored!'''
vanaf = (datetime.date.today()-datetime.timedelta(days=botsglobal.ini.getint('settings','maxdaysarchive',180))).strftime('%Y%m%d')
for row in botslib.query('''SELECT archivepath FROM channel WHERE archivepath != '' '''):
vanafdir = botslib.join(row['archivepath'],vanaf)
for entry in glob.iglob(botslib.join(row['archivepath'],'*')):
if entry < vanafdir:
if entry.endswith('.zip'):
try:
os.remove(entry)
except:
pass
else:
shutil.rmtree(entry,ignore_errors=True)
--