Forum

Author Topic: Long Running background process in python  (Read 4191 times)

s093294

  • Newbie
  • *
  • Posts: 23
    • View Profile
Long Running background process in python
« on: July 03, 2015, 12:07:24 PM »
Is it possible to have a process running in the background doing http requests from within a python script added at startup;

I made the following to test if I could get an accessToken using a external command call, which works perfectly.

def signin():
   print("Testing");
   print(os.getcwd());
   #call(["C:/Users/pksorensen/AppData/Local/Agisoft/PhotoScan Pro/scripts/S-Innovations.DevOpt.OpenIdConnect.exe"])
   process = subprocess.Popen(["C:/Users/pksorensen/AppData/Local/Agisoft/PhotoScan Pro/scripts/S-Innovations.DevOpt.OpenIdConnect.exe"], stdout=subprocess.PIPE)

   accessToken = process.communicate()[0]
   print(accessToken)



PhotoScan.app.addMenuItem("AscendXYZ/Sign in", signin)

I would like to spawn a loop that every 5 mins checks for jobs using a HTTP endpoint. Is this possible, or would the user have to click a button everytime it should check?