Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Executing remote python script

    General and Desktop
    3
    6
    2110
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      fmdragon last edited by

      I have a python script on my server that I need to execute at certain times (basically whenever I upload a file, we execute this script on said file). How would I go about doing this? The file upload fine, but I have no idea where to start when it comes to executing the python script. Any help would be appreciated, thanks!

      1 Reply Last reply Reply Quote 0
      • S
        SergioDanielG last edited by

        Some years ago I needed do something like you.
        I can't remember the code, but I used os.stat() every x seconds to check modifications on directories. When stat was modified, ran a special funtion to process changed files (always new files in my case).
        Hope it help.

        www.ftatv.com.ar El foro argentino de la TV libre

        1 Reply Last reply Reply Quote 0
        • T
          tobias.hunger last edited by

          How does this relate to Qt? What OS are you uploading to?

          1 Reply Last reply Reply Quote 0
          • F
            fmdragon last edited by

            Sorry about that, I should have given a bit more detail.

            I'm using Qt to build my client on the front end. I want to execute the Python script on a Ubuntu server from the client after I upload a file (done using QNetworkRequest to POST the data).

            1 Reply Last reply Reply Quote 0
            • T
              tobias.hunger last edited by

              I would not even try to trigger the script from the client side. Can't you make your server trigger the script in response to the upload?

              If that is not possible then services like upstart (at least the newer versions) can actually monitor directories and trigger scripts whenever they change. Or you can use inotifywait to do the same without upstart.

              1 Reply Last reply Reply Quote 0
              • F
                fmdragon last edited by

                Thanks for the reply Tobias. I'll figure out something server side as oppose to triggering it from the client.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post