8 Replies Latest reply: Aug 11, 2014 2:19 PM by Agostinho RSS

    ODI 12c ImportError: no module named smtplib

    Agostinho

      Hi All.

       

      I Created a jython code that sends an email when a package fail.

       

      When I execute the package using the local agent it works fine, but when I execute using "windows agent" it returns the following error:

       

      ODI-1590: The execution of the script failed.

      Caused By: org.apache.bsf.BSFException: exception from Jython:

      Traceback (innermost last):

        File "<string>", line 2, in ?

      ImportError: no module named smtplib

       

      Thanks in advance for you help.

       

       

      Agostinho

        • 1. Re: ODI 12c ImportError: no module named smtplib
          Chuggans-Oracle

          That means that the smtplib module is not in the Jython search path for modules for your 'windows agent' for one reason or another.

           

          You could troubleshoot by importing the sys module and then check the contents of the current search path contained in sys.path when running with local agent. That would let you see which locations are in the search path and find out where smtplib.py lives. You could then add the location to the search path of Jython with sys.append("/path/to/module") or possibly place an existing copy of this module into the current search path.

           

          FYI - I find smtplib in oracledi/client/jdev/extensions/oracle.odi.navigator/scripting/Lib/smtplib.py & oracledi.sdk/lib/Lib/smtplib.py

           

          HTH

           

          Regards

           

          Craig

          • 2. Re: ODI 12c ImportError: no module named smtplib
            Agostinho

            Craig,


            I Tried both paths you said but unfortunaly it didn't work.


            Could you please guide me on how to do this:  "You could troubleshoot by importing the sys module and then check the contents of the current search path contained in sys.path when running with local agent. That would let you see which locations are in the search path and find out where smtplib.py lives." i have no idea how to do it.


            Thanks in advance,


            Agostinho



            • 3. Re: ODI 12c ImportError: no module named smtplib
              Phanikanth

              Hi Agostinho,

               

              Please check below points, hope this may helps you

               

              1.Please check the ODI Agent in Topology Manager to determine on which host it is running then proceed to its installation folder and verify that Jython is included with the Agent installation folders: ◦In oracledi\bin - jython.sh

              --> In oracledi\lib\scripting - jython.jar, cachedir, and lib

              --> In oracle\lib\scripting\lib - numerous jython .py files

              2.Also give Unix user account full permissions to every file and folder in the Agent installation and the java installation.

              3.Restart the Agent.

              4.Test the Agent in Topology Manager (ensure that the hostname is correct). If the test is successful, retest the Package/Scenario.

               

              Regards,

              Phanikanth

              • 4. Re: Re: ODI 12c ImportError: no module named smtplib
                Chuggans-Oracle

                Hi Agostinho,


                I mean that to find the current search path you could use something like this to list out the current search path entries to C:\temp\tempSearchPath.txt when running with the local agent and then compare with the other agent:

                 

                import sys
                searchPath = sys.path
                o = open(r"C:\temp\tempSearchPath.txt", "w")
                if len(searchPath) == 0:
                    o.write("Nothing in the search path")
                else:
                    for f in searchPath:
                        o.write(f + "\n")
                o.flush()
                o.close()
                
                

                 

                You would then either need to make sure that the smptplib.py module is available in one of the locations that are written out to file for the non-working agent or you could add the current location of the module to the search path by adding something like this to your current script if you have the module in C:\smtplib:

                 

                import sys
                sys.append('C:\smtplib')
                import smtplib
                
                

                 

                Regards

                 

                Craig

                • 5. Re: ODI 12c ImportError: no module named smtplib
                  Agostinho

                  Hi Phanikanth,

                   

                  Unfortunately I couldn't find the paths that you said in the server.

                   

                  what concerns me is that when I execute the package directly on the server that have the odi istalled, using the local agent,  it works fine.

                   

                  But when I try to execute using the windows agent (it is running in the same server) returns that error.

                   

                  Any idea ?

                   

                  Thanks in advance

                   

                  Agostinho

                  • 6. Re: ODI 12c ImportError: no module named smtplib
                    Agostinho

                    Hi Craig,

                     

                    I Must have made a mistake because this code did not create the file with the paths (that is what I understand your code does).

                     

                    I tried to execute it as a procedure.

                     

                    Thanks in advance,

                     

                    Agostinho

                    • 7. Re: ODI 12c ImportError: no module named smtplib
                      user8725805

                      Hi Agostinho ,

                       

                      Could find any solution to this issue . we are also having similar issue .

                      We need to include certain jar files

                       

                      when I placed the ODI files in following directory

                      <YourODIAgentHome>\odi\agent\lib


                      But the agent was not working .

                      When I removed the jar files the agent ran successfully .


                      I placed the file in below folder and tried running local agent but no luck

                      \Users\<yourUserName>\AppData\Roaming\odi\oracledi\userlib

                       

                       

                      It is throwing following error

                       

                      ODI-1590: The execution of the script failed.

                      Caused By: org.apache.bsf.BSFException: BeanShell script error: Sourced file: inline evaluation of: ``import oracle.odi.km.exception.OdiKmException; // ToDo: Enter the Java packages  . . . '' : Typed variable declaration : Class: MasterController

                      • 8. Re: ODI 12c ImportError: no module named smtplib
                        Agostinho

                        Hello user8725805,

                         

                        The only way we found to fix it was re-installing our ODI.

                         

                        Regards,

                         

                        Agostinho