connectors/PYRO/__init__.py
changeset 2334 d1470c052662
parent 2324 1cf3768ebf85
child 2338 2c3222433244
equal deleted inserted replaced
2333:81abf93b4684 2334:d1470c052662
   124         confnodesroot.logger.write_error(_("Cannot get PLC ID - connection failed.\n"))
   124         confnodesroot.logger.write_error(_("Cannot get PLC ID - connection failed.\n"))
   125         return None
   125         return None
   126 
   126 
   127     if servicetype != "PYROS":
   127     if servicetype != "PYROS":
   128         ID,PSK = IDPSK
   128         ID,PSK = IDPSK
   129         secpath = os.path.join(str(confnodesroot.ProjectPath), 'psk', ID+'.secret')
   129         secdir = os.path.join(str(confnodesroot.ProjectPath), 'psk')
       
   130         if not os.path.exists(secdir):
       
   131             os.mkdir(secdir)
       
   132         secpath = os.path.join(secdir, ID+'.secret')
   130         with open(secpath, 'w') as f:
   133         with open(secpath, 'w') as f:
   131             f.write(ID+":"+PSK)
   134             f.write(ID+":"+PSK)
   132 
   135 
   133     _special_return_funcs = {
   136     _special_return_funcs = {
   134         "StartPLC": False,
   137         "StartPLC": False,