5 Replies Latest reply on Feb 23, 2011 2:46 AM by julio.dilisa

    Automation using Python

    julio.dilisa

      Hello,

       

      I would like to know if other people are using Python for automation.

      I wrote some script and may be we could exchange our experience.

       

      One question is how do you run your python script ?

       

      Thanks

       

      Regards

       

      Julio

      TAS-B

        • 1. Re: Automation using Python
          artsiom.shchatsko

          Well, I played with Python and DxD automation but for me the problem is that it can only be used under Windows when I need it under Linux.

          All the communications are done over Python win32com module.

          2 of 2 people found this helpful
          • 2. Re: Automation using Python
            misael.perez.martinez

            I've done a few python scripts for DxD and othe people in my team do so also.

             

            I'm not sure I understand your question. To run my scripts I usually double click on them from windows explorer...

             

            -- Misael

            • 3. Re: Automation using Python
              julio.dilisa

              Hi,

               

              Thank you for the answer.

               

              Why question about the way you run python script ?

               

              As written in documentation, a script can be run externally or internally of the application.

              The execution time is different, quickier in "internal" mode.

              So I can run my script externally (double click on program name).

              To run internally,I use a workaround : I create a button (efm file) that will launch my

              python script via a WshShell.run(script). Here a sample (not optimized) ;

               

              ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

              Sub Button1_EventClick()
              Dim This : Set This = Button1
              Dim WshShell

              Set WshShell = CreateObject("WScript.Shell")

              ' open normal and wait

              var = Msgbox("N:\eef_custom\py\RAMS\NewComDxDes2Rams.py" , vbQuestion & vbOKCancel,"CHECK")

              If var <> vbOK Then
                Exit Sub
              End If 

                Returnit = WshShell.run("python.exe N:\eef_custom\py\RAMS\NewComDxDes2Rams.py",1,True)

              'Msgbox("RETOUR: " & Returnit)

              If Returnit <> 0 Then
                Msgbox("RETOUR: " & Returnit)
                endmsg = "RAMS  ERREUR code ::: " & Returnit & vbCrlf & "Progamme s'est mal terminé"
                WshShell.Popup endmsg,,genTitle,0 + 16
              Else
                endmsg = "Programme terminé : OK"
                WshShell.Popup endmsg,,genTitle,0 + 64
              End If

              Set Wshell = Nothing

              End Sub

              ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

               

              This is enough for the scripts I wrote (DxDes, Expedition,Padstackeditor,etc...)

               

              I explored also the 'pys -- python integrated in wsh) ' file with python, it ran once but after I had some small problems so I abandoned this path (for the moment).

               

              So I would like to know what is the way other people used to run the scripts.

               

              May be we can exchange some help regarding Python and EE automation.

               

              By the way I am not a programmer.

               

              Best regards

              • 4. Re: Automation using Python
                misael.perez.martinez

                Hi,

                 

                I've never used the "internal" mode. The scripts I've created usually finish in a couple of seconds (the largest one I have takes about 2 minutes to run through a ~300 page schematic) so I haven't tried to optimize them.

                 

                In the past I did create a bunch of forms (using VBScript) before I started using python and I did see a significant performance increase when migrating to python.

                 

                BTW, I'm not a programmer either...

                 

                -- Misael

                • 5. Re: Automation using Python
                  julio.dilisa

                  Hello,

                   

                  Thank you for answering my request.

                   

                  Best Regards

                   

                  Julio