Many thanks for you answer Thomas!

But I feel I didn't explained clearly my problem.

With your code, my problem is now to know when my program finished.

My plugin is organized like that :

1 # here it is the main of the plugin


2 # launch of my external program


3 # treatment of result of program to load new structure in PyMoL
This part has to wait the end of program. If I wait -> I can use PyMoL and
If I put in daemon it will be execute without result of my program

So my question is to know how can I wait the result of my program but with
the possibility to use PyMoL. And when it is finished, to go on lines
programming in the plugin...

Thank you again for your help,
Ed'

On Tue, Aug 28, 2012 at 5:48 PM, Thomas Holder <
spel...@users.sourceforge.net> wrote:

> Hi Ed,
>
> this is possible. Example:
>
> def foo(a, b, c):
>
>   command = "./myprogramm arg1 arg2"
>   process = subprocess.Popen(command, shell=True,
>       stdout=subprocess.PIPE, stderr=subprocess.PIPE)
>   process.wait()
>
> def foo_async(a, b, c):
>   import threading
>   t = threading.Thread(target=foo, args=(a, b, c))
>   t.setDaemon(1)
>   t.start()
>
> Hope that helps.
>
> Cheers,
>   Thomas
>
> Mister Vanhalen wrote, On 08/28/12 17:33:
>
>  Hi PyMoLers,
>>
>> I need to launch an external program through a plugin. When I launch my
>> program by my button in my interface (the plugin) through this usual code :
>> command =  "./myprogramm arg1 arg2"
>> process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
>> stderr=subprocess.PIPE)
>> process.wait()
>>
>> PyMol waits the end of the program to screen a windows with my result and
>> load new structure and cgo in PyMol, that's normal.
>>
>> Is it possible that PyMol can go on and only when my program has
>> finished, my plugin screens the results and load new structure in PyMoL.
>> I would like that we can use PyMoL in the meantime that my program is
>> running.
>>
>> Is it possible? I don't know how to put the thread for that...
>>
>> Thank you for your help,
>>
>> Ed'
>>
>
> --
> Thomas Holder
> MPI for Developmental Biology
> Spemannstr. 35
> D-72076 Tübingen
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to