Forum Stats

  • 3,838,337 Users
  • 2,262,351 Discussions
  • 7,900,590 Comments

Discussions

Scripting BefImport failing

v.nones
v.nones Member Posts: 11
edited Jun 12, 2015 4:55AM in Financial Data Management

Hi everyone,

I am new on FDMEE and I am having some issues launching fdmee scripts.
The operation is the same for all the files except for the ones in DSLEMAFIN, where I added a line trying to eliminate the double quotation marks of all the members of my file. When I launch the whole thing, it says in the log:


2015-06-11 11:12:58,106 INFO  [AIF]: Executing the following script: \\hypiagdesdata.corp.iberia.es\FDMEE/data/scripts/event/BefImport.py

2015-06-11 11:12:58,127 ERROR [AIF]: The script has failed to execute:

2015-06-11 11:12:58,852 FATAL [AIF]: Error in Launch GL Load Balances Data

2015-06-11 11:12:58,866 INFO  [AIF]: FDMEE Process End, Process ID: 2367

But if I launch only the script that affects the files in DSLLOAD location, it works and process the whole file.

Could anybody please help me with this?

import os
import re

if fdmContext["LOCNAME"] == "DSLLOAD":
     fdmAPI.logInfo(fdmContext["LOCNAME"])
     try:
          filename = fdmContext["FILENAME"]
          inbox = fdmContext["INBOXDIR"]
          #filedir = fdmContext["FILEDIR"]
          fdmAPI.logInfo(filename)
          fdmAPI.logInfo(inbox)
          file = inbox + "\\DSLLOAD\\" + filename
         file_out = inbox + "\\DSLLOAD\\" + filename + ".out"
          #file = inbox + "\\" + filedir + "\\"+filename
          #file_out = inbox + "\\" + filedir + "\\"+filename + ".out"
          fdmAPI.logInfo(file)
          fin = open(file,"r")
          fout = open(file_out,"w")
          for line in fin:
               lineSplit=line.split(",")
               #fdmAPI.logInfo(lineSplit[1])
               lineIni=lineSplit[0]+","+lineSplit[1]+","+lineSplit[2]+","+lineSplit[3]+","+lineSplit[4]+","+lineSplit[5]+","+lineSplit[6]
               fout.write(lineIni+",PAX_QTY,"+lineSplit[7]+"\n")
               fout.write(lineIni+",AVL_SEAT_QTY,"+lineSplit[8]+"\n")
               fout.write(lineIni+",RPK_QTY,"+lineSplit[9]+"\n")
               fout.write(lineIni+",ASK_QTY,"+lineSplit[10]+"\n")
               fout.write(lineIni+",TOTAL_FLT_NOS,"+lineSplit[11]+"\n")
               fout.write(lineIni+",TOTAL_FLT_LEGS,"+lineSplit[12])
          fin.close()
          fout.close()
     except IOError, err:
         fdmAPI.logError("My error"+ str(err))

     os.remove(file)
     os.rename(file_out,file)

if fdmContext["LOCNAME"] == "DSLEMAFIN":
     fdmAPI.logInfo(fdmContext["LOCNAME"])
     try:
          filename = fdmContext["FILENAME"]
          inbox = fdmContext["INBOXDIR"]
          #filedir = fdmContext["FILEDIR"]
          fdmAPI.logInfo(filename)
          fdmAPI.logInfo(inbox)
          file = inbox + "\\DSLEMAFIN\\" + filename
          file_out = inbox + "\\DSLEMAFIN\\" + filename + ".out"
          #file = inbox + "\\" + filedir + "\\"+filename
          #file_out = inbox + "\\" + filedir + "\\"+filename + ".out"
          fdmAPI.logInfo(file)
          fin = open(file,"r")
          fout = open(file_out,"w")
          for line in fin:

               line=line.replace('"','')
               lineSplit=line.split(",")
               #fdmAPI.logInfo(lineSplit[1])
               lineIni=lineSplit[0]+","+lineSplit[1]+","+lineSplit[2]+","+lineSplit[3]+","+lineSplit[4]+","+lineSplit[5]+","+lineSplit[6]+","+lineSplit[7]","+lineSplit[8]
               fout.write(lineIni+",psj_qty,"+lineSplit[9]+"\n")
               fout.write(lineIni+",avl_seat_qty,"+lineSplit[10]+"\n")
               fout.write(lineIni+",rpk,"+lineSplit[11]+"\n")
               fout.write(lineIni+",ask,"+lineSplit[12])
          fin.close()
          fout.close()
     except IOError, err:
         fdmAPI.logError("My error"+ str(err))

     os.remove(file)
     os.rename(file_out,file)


if fdmContext["LOCNAME"] == "DSLTAKEOFFMR":
     fdmAPI.logInfo(fdmContext["LOCNAME"])
    try:
          filename = fdmContext["FILENAME"]
          inbox = fdmContext["INBOXDIR"]
          #filedir = fdmContext["FILEDIR"]
          fdmAPI.logInfo(filename)
          fdmAPI.logInfo(inbox)
          file = inbox + "\\DSLTAKEOFFMR\\" + filename
          file_out = inbox + "\\DSLTAKEOFFMR\\" + filename + ".out"
          #file = inbox + "\\" + filedir + "\\"+filename
          #file_out = inbox + "\\" + filedir + "\\"+filename + ".out"
          fdmAPI.logInfo(file)
          fin = open(file,"r")
          fout = open(file_out,"w")
          for line in fin:
               lineSplit=line.split(",")
               #fdmAPI.logInfo(lineSplit[1])
               lineIni=lineSplit[0]+","+lineSplit[1]+","+lineSplit[2]+","+lineSplit[3]+","+lineSplit[4]+","+lineSplit[5]+","+lineSplit[6]+","+lineSplit[7]+","+lineSplit[8]
               fout.write(lineIni+",GC_KM_DIS,"+lineSplit[9]+"\n")
               fout.write(lineIni+",FIRST_SEAT_QTY,"+lineSplit[10]+"\n")
               fout.write(lineIni+",CLUB_SEAT_QTY,"+lineSplit[11]+"\n")
               fout.write(lineIni+",WTP_SEAT_QTY,"+lineSplit[12]+"\n")
               fout.write(lineIni+",ECON_SEAT_QTY,"+lineSplit[13]+"\n")
               fout.write(lineIni+",BLOCK_HRS_DUR,"+lineSplit[14]+"\n")
               fout.write(lineIni+",TAXI_HRS_DUR,"+lineSplit[15]+"\n")
               fout.write(lineIni+",TAXI_OUT_HRS_DUR,"+lineSplit[16]+"\n")
               fout.write(lineIni+",TAXI_IN_HRS_DUR,"+lineSplit[17]+"\n")
               fout.write(lineIni+",FLY_HRS_DUR,"+lineSplit[18]+"\n")
               fout.write(lineIni+",PAX_FIRST_QTY,"+lineSplit[19]+"\n")
               fout.write(lineIni+",PAX_CLUB_QTY,"+lineSplit[20]+"\n")
               fout.write(lineIni+",PAX_WTP_QTY,"+lineSplit[21]+"\n")
               fout.write(lineIni+",PAX_ECON_QTY,"+lineSplit[22]+"\n")
               fout.write(lineIni+",PAX_NR_QTY,"+lineSplit[23]+"\n")
               fout.write(lineIni+",ASK_FIRST,"+lineSplit[24]+"\n")
               fout.write(lineIni+",ASK_CLUB,"+lineSplit[25]+"\n")
               fout.write(lineIni+",ASK_WTP,"+lineSplit[26]+"\n")
               fout.write(lineIni+",ASK_ECON,"+lineSplit[27]+"\n")
               fout.write(lineIni+",OPS,"+lineSplit[28]+"\n")
               fout.write(lineIni+",RPK_FIRST,"+lineSplit[29]+"\n")
               fout.write(lineIni+",RPK_CLUB,"+lineSplit[30]+"\n")
               fout.write(lineIni+",RPK_WTPLUS,"+lineSplit[31]+"\n")
               fout.write(lineIni+",RPK_ECON,"+lineSplit[32]+"\n")
               fout.write(lineIni+",RPK_NR,"+lineSplit[33])
          fin.close()
          fout.close()
     except IOError, err:
         fdmAPI.logError("My error"+ str(err))

     os.remove(file)
     os.rename(file_out,file)

Thank you!

Valeria

Tagged:

Best Answer

Answers

This discussion has been closed.