python

  • 29 Jun

    How to use Python within Limagito File Mover

    How to use Python within Limagito File Mover

    In version v2025.6.29.0 we added a Python as Destination option. This is the first build so we know it still needs fine-tuning. Please tell us what you think and if you find any issues please let us know. Also, Python feature requests are welcome.

    python logo

    • 32-bit versions of Limagito File Mover will only work with 32-versions of Python
    • 64-bit versions of Limagito File Mover will only work with 64-bit versions of Python.
    • Our File Mover will use the default registered version of Python
    • We did our testing with Python v3.13
    • You can download a Python distribution from here: link
    • We’ve added quite some  Rule related Var, they always tart with ps (PythonScript):
      • Readable within Python (case sensitive):
        • String Var
          • psFileName
          • psFilePath
          • psFileDir
          • psFileSubDir
          • psFileSubDirFirst
          • psFileSubDirLast
          • psFilePath
          • psFileSubPath
          • psFileSubPathFirst
          • psFileSubPathLast
          • psSourcePath
          • psFileChecksum
          • psDestinationID
          • psRuleTempPath
          • psExitCode
          • psVSA
          • psVSB
          • psVSC
          • psVSD
          • psVSE
          • psRFD
          • psRFN
          • psRFW
          • psRFP
          • psQDC
          • psQSC
          • psQST
          • psFSO
          • psSTR
          • psDTR
          • psFCA
          • psFCB
          • psFCC
          • psFCD
          • psFCE
          • psLRT
          • psLCI
        • Integer
          • psDeleteAfterCopy
          • psDirectionID
          • psRuleID
        • Int64
          • psFileSize
          • psCounter
          • psTotalFiles
          • psTotalFilesSrcError
          • psTotalFilesDstError
          • psTotalControlSrcError
          • psTotalControlDstError
          • psCurrentFiles
          • psCurrentFilesSrcError
          • psCurrentFilesDstError
          • psCurrentControlSrcError
          • psCurrentControlDstError
          • psVIA
          • psVIB
          • psVIC
          • psVID
          • psVIE
        • DateTime as Float
          • psFileDateTime
          • psFileADateTime
          • psFileCDateTime
          • psFileMDateTime
      • Writeable within Python (case sensitive):
        • String
          • psVSA
          • psVSB
          • psVSC
          • psVSD
          • psVSE
          • psRFP
          • psRFN
          • psFCA
          • psFCB
          • psFCC
          • psFCD
          • psFCE
        • Integer
          • psExitCode
        • Int64
          • psVIA
          • psVIB
          • psVIC
          • psVID
          • psVIE
          • psTotalFiles
          • psTotalFilesSrcError
          • psTotalFilesDstError
          • psTotalControlSrcError
          • psTotalControlDstError
          • psCurrentFiles
          • psCurrentFilesSrcError
          • psCurrentFilesDstError
          • psCurrentControlSrcError
          • psCurrentControlDstError

     

    • In the following example we added two Python Destinations to a Rule:

    limagito file mover python as destination

    • First Python as Destination show some information about the two Var we will be using: psFileName and psFilePath

    limagito file mover python as destination setup

    • Second Python as Destination will use a file we found in the source to copy it to a Destination

    limagito file mover python as destination setup

    • RunTime Log Result:

    limagito file mover python as destination runtime log result

    If you need any help with this new ‘Python within Limagito’ option, please let us know.

    Best Regards,

    Limagito Team

    #python #managedfiletransfer #filetransfer #filemanagement

    By Limagito-Team Python
  • 13 Apr

    Running a python script with Command as source but rule doesn’t end

    Running a python script with Command as source but rule doesn’t end

    Q: I’m trying to setup a rule with a cmd as source, it executes a python script. When I execute the rule, it works well (I have the expected result), but the rule doesn’t end. So, I don’t have any output in the Limagito GUI.

    It seems that the process continues to run :

    20/01/2025 12:08:02 Execute Rule Request from administrator at 192.168.92.38 []

    20/01/2025 12:08:02 Execute Command as Source: [CMD] Command, Command Line: CMD /C python xxx\mediaprint_api_v3.py

    20/01/2025 12:08:02 Set CMD as Source Output to C:\Users\ADMINI~1\AppData\Local\Temp\LimagitoX\LimagitoX.83\

    20/01/2025 12:08:02 Execute M1 Command, Exception Error: Cannot perform this operation when process is running

    20/01/2025 12:08:02 Execute Command as Source Succes, ExitCode : 4294967295, Result Path: C:\Users\ADMINI~1\AppData\Local\Temp\LimagitoX\LimagitoX.83\

    20/01/2025 12:08:07 Rule Disabled by administrator at 192.168.92.38 []

    Should I check an option when configuring the rule to avoid that ?

    A: You are using CMD /C so that part is OK. I guess you need to add something to the python script that will close afterwards.

    ChatGPT info:

    limagito file mover Running a python script

    Customer feedback:

    Indeed, i was trying things and I it ended successfully with a sys.exit(0)

    If you need any help with this ‘Running a python script’ question, please let us know.

    Best Regards,

    Limagito Team

    #python #managedfiletransfer #filetransfer #filemanagement

    By Limagito-Team Command ,
  • 28 Oct

    How to execute script on temp folder

    How to execute script on temp folder

    Q: I would like to change the content of a file located on an FTP. I am trying to do so with a python script executed thanks to command option. So, my source is an FTP, and the destination is the same FTP. Is there a way to execute the command script on the temp folder so it would follow these steps :

    1. Move file from FTP to AppData\Local\Temp…
    2. Execute script on the moved file.
    3. Move the edited file to the same FTP.

    I succeed doing it with 2 rules :

    Rule 1 :

    1. Move file from FTP to a local folder.
    2. Execute script on the moved file.

    Rule 2 :

    1. Move file from local folder to the same FTP.

    Thank you!

    A:  It should be possible in one Rule.

    Your Destination setup will have 2 Destination entries. In my example below the second destination is WIN, in your case it would be FTP.
    In the Command setup you can use parameters like %SFP%SFN
    These parameters will point to the Source file located in the temporary folder after download from FTP as Source.

    limagito file mover script on Temp folder

    It is a good idea to adjust the Function setup. We changed the ‘Destination Options’ to ‘Exit Cyclus on Error’. So if the command in the first entry fails it will not move the file to the FTP server. It will retry the Command during the next scan.

    limagito file mover function exit cyclus on error

    #command #filetransfer #filemanagement

    If you need any help with this ‘execute script on Temp folder’ option, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Command ,
SEARCH