On 31/05/2019 20:41, nathan tech wrote:

> Is it possible, in python, to store a running task id in the registry?

>From mention of the registry I assume you are running Windows?
There is no registry on Unixlike systems.

The answer in either case is yes since a task ID is just a number.
However if the task ends the number will still be stored,
so checking whether the ID refers to a live task is the trickier bit.

> I might be using the complete wrong terms here, because I'm only used to 
> doing this with a specific language, 

Is the language C/C++? If so you may know the OS API calls needed
and you could access those directly from Python using ctypes....
That might make your job more familiar and easier.

Alternatively, there are OS shell commands that might work
that you can call from subprocess.

The os module has a bunch of functions that might help but
many of them are Unix only or behave differently on Windows/Unix
so you will need to study the documentation and probably
experiment a bit. Things like waitpid() might work for example,
but I haven't tried. Personally I'd use the shell command approach
for Unix but no idea what I'd use for Windows.

I suspect there may be a dynamic registry entry you can read
using the winreg registry module.

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:

Reply via email to