12 Replies Latest reply on Dec 14, 2012 10:52 AM by rv

    Script error through ODI

    rv
      Hi,
      I am calling a Python script from odi through odi os command.
      But if an error occurs internally in the script the ODI is unable to show that error in the Opertor .It is simply showing "Odi os command returns 1".
      The error file is made at different location.
      But i need to show all the script error through odi operator.
      Is there any utility or something like that which can catch the error and shows through odi operator.

      Please reply....

      Thanks
        • 1. Re: Script error through ODI
          Bhabani Ranjan Mahapatra
          If you have the error file generated then we can read those line and print them in operator. Send me the error file. I can say the codes to print it in operator.

          If you know jython then you can even read the error line in to a string and raise the same string which will print it in operator.

          Thanks
          Bhabani
          http://dwteam.in
          1 person found this helpful
          • 2. Re: Script error through ODI
            rv
            Thanks,

            Can you please send me the details of how to print that on operator.
            Suppose my error file name is "Test.err".

            I tried by using jython code in ODI procedures.I was testing with the following code in Procedures
            ----------------
            import re
            str1='This is a program'
            if re.search("is",str1):
            print ' Match found'
            else:
            print ' Not Found'

            -------------------------------------
            The Odi procedure is running successfully but on the message box it is not showing the output .
            It is showing blank.

            Please reply fast..
            • 3. Re: Script error through ODI
              Bhabani Ranjan Mahapatra
              please provide one tab or space before raise to avoid expecting INDENT" error
              import re
              str1='This is a program'
              if re.search("is",str1):
              raise ("\n\n\n Match found \n\n\n")
              else:
              raise ("\n\n\n Not Found \n\n\n")
              1 person found this helpful
              • 4. Re: Script error through ODI
                rv
                Is there a difference between print and raise.

                I ran the code with raise but it is showing error like:
                -------------------------------------------------------------
                org.apache.bsf.BSFException: exception from Jython:
                SyntaxError: ("mismatched input 'raise' expecting INDENT", ('<string>', 4, 0, 'raise ("\\n\\n\\n Match found \\n\\n\\n")\n'))

                     at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
                     at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:346)
                     at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)
                     at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2457)
                     at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:47)
                     at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)
                     at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
                     at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
                     at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
                     at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:537)
                     at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
                     at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
                     at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
                     at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
                     at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
                     at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
                     at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
                     at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
                     at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
                     at java.lang.Thread.run(Thread.java:662)
                ------------------------------------------------------------------------------------------------------------------------------------
                • 5. Re: Script error through ODI
                  Bhabani Ranjan Mahapatra
                  Have you given a space as i said just before to the raise??? you have not given a space that why you are getting INDENT error

                  import re
                  str1='This is a program'
                  if re.search("is",str1):
                  <space required> raise ("\n\n\n Match found \n\n\n")
                  else:
                  <space required> raise ("\n\n\n Not Found \n\n\n")
                  1 person found this helpful
                  • 6. Re: Script error through ODI
                    rv
                    This works...
                    How to read the error file and return the error in the message box.

                    Suppose my error file is on the location "/E/common.test.err".
                    I need to display the text inside the test.err in the message box.
                    • 7. Re: Script error through ODI
                      Bhabani Ranjan Mahapatra
                      technology: Jython

                      file = open("D:/FF/test.txt", "r")

                      for line in file.readlines():
                      raise line

                      file.close()

                      Thanks
                      Bhabani
                      http://dwteam.in
                      1 person found this helpful
                      • 8. Re: Script error through ODI
                        rv
                        Is it reading only the first line of the file.
                        What if we want read all the text present in the file.

                        Thanks
                        • 9. Re: Script error through ODI
                          Bhabani Ranjan Mahapatra
                          file = open("D:/FF/test.txt", "r")

                          allline=' '
                          for line in file.readlines():
                          allline=allline+line

                          raise allline
                          file.close()

                          Hope I answer all your question.

                          Thanks
                          Bhabani
                          http://dwteam.in
                          • 10. Re: Script error through ODI
                            rv
                            Amazing.....
                            Thanks a lot.....
                            I owe you a treat man..........
                            Thanks for your response
                            • 11. Re: Script error through ODI
                              Bhabani Ranjan Mahapatra
                              you are welcome :)
                              Please mark the answers as helpful if it really helped.
                              Thanks.
                              • 12. Re: Script error through ODI
                                rv
                                Did it...