Hi all,

I'd like to write a python script that can execute coot functions from a new 
thread. I noticed a function run_python_thread() defined in coot_gui.py that 
might be useful for this. For example:

# script for adding a water every 2 seconds

import time

def addWater():
        while True:
            time.sleep(2)
            print "water placed"
            place_typed_atom_at_pointer('Water')      # causes segmentation 
error

run_python_thread(addWater, ())    


This new thread correctly prints "water placed" to the terminal every 2 
seconds. However, Coot crashes with a segmentation error when 
place_typed_atom_at_pointer('Water') is executed. This error only occurs when 
Coot functions are executed from the new thread. Any suggestions? I don't want 
the main thread to be interrupted (the gui shouldn't freeze up). I've tried 
using Coot-0.7.1 stable and Coot-0.8-pre-5335, both for Mac. Thanks for any 
help, I'm a bit new to scripting.

Best,

Matt

Reply via email to