Hello,

Thank you for your responses.

I am indeed developing for windows at the moment, with an eye casually 
glancing in the MAC direction as a possibility for the future that I 
shall think about.


I'm sorry I couldn't explain better, but being only familiar with the 
concept in my head from one language, I wasn't quite sure what to say 
for each thing, how to explain it.


The language is actually a bit obscure, and is used in the development 
of MUDs, Multi-user dungeons.


I never considered it would be broken down into several modules, but 
that makes sense.


Now it has been mentioned, I do recall, on linux, briefly playing with 
psutil to retrieve memory values for a few tasks I keep running on my 
server.

To that end, I think I now know roughly what to do.


Something like this:

import psutil

import os

path=os.getcwd()+"\\program.exe"

slist=[]

for x in psutil.process_iter():

  if(x.exe()==path):

   slist.append([x, x.create_time]_)

r.sort() # not sure how to sort by second element, but I'd sort the list 
by start time

if(len(r)>1):

  # send signal to other program to tell it to do something, either 
through a ntofiy app or through psutil.send_signal()

  # exit the program


Hope I'm making more sense now, and thank you for the help everyone.

Nate

On 01/06/2019 04:30, Mats Wichmann wrote:
> On 5/31/19 1:41 PM, nathan tech wrote:
>> Hi there,
>>
>> So for a future project of mine, I was wondering something.
>>
>> Is it possible, in python, to store a running task id in the registry?
>>
>> I might be using the complete wrong terms here, because I'm only used to
>> doing this with a specific language, but here's what I want to do:
>>
>>
>> python mytest.py:
>>
>> if(registry.taskid==valid_task):
>>
>>    print 'already open'
>>
>>    send to open program to make a ding noise.
>>
>>
>> I understand that the second part, the "send to program" requires the
>> program to handle being sent a "wake up!" event, which is fine, it's the
>> "is it already running" which I am not sure on.
> there's a lot your question leaves unasked...  do you want to just code
> your own apps and have one be able to poke another? that's one problem,
> you can define the interface yourself.  Or do you want to be able to
> poke arbitrary running tasks?  that ends up more complicated.  many
> systems have notification APIs that you can make use of, some of those
> are more oriented to that model (the mobile systems Android and Tizen),
> some a little less but still support it (Windows - it's a more prevalent
> thing in the UWP model).
>
> the psutil module can let you find things out about processes, might be
> useful in your "is the task running" query.
>
> if it's okay to start processes together and it's not arbitrary, the
> multiprocessing module may be of some help.
>
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to