Files
storage_fresco/pySAP.py
2019-05-23 13:36:01 +00:00

43 lines
1017 B
Python
Executable File

#!/usr/bin/python
import sys, os
sys.path.append (".")
from time import time, strftime, sleep
class pySAP:
def __init__ (self, *dummy, **args):
"""
Initialize a new SAP exporter
"""
self.path = args.get ("path", "/opt/sap/")
self.time = time ()
def log (self, msg):
"""
Print message if in verbose mode.
"""
mins = int (strftime ("%M"))
file = open (self.path + strftime ("%Y_%m_%d_%H_") + '%02d' %(mins), "a")
file.write ( msg )
file.close ()
if __name__ == "__main__":
from pySAP import *
from DB_ERP import DB_ERP
#sapfile = pySAP (path = "/opt/sap/")
sapfile = pySAP (path = "/Users/michi/logtest/")
#conn = DB_ERP ("/opt/data/storage_ERPTrace.db3")
conn = DB_ERP ("/Users/michi/devel/S7ISO/data/storage_ERPTrace.db3")
conn.markinsertionsasunread ()
sapfile.log ('')
for a, c, m, u in conn.getinsertions ():
if c=='':
c = 0
sapfile.log ('%05d;%010d;%s;%s\n' % (int (a), int (c), m, u))
conn.markinsertionsasread ()