Syncronize a DSSS signal

Dear all, I’m trying to syncronize the receiving signal from a Direct
Sequence Spread Spectrum.I have to divide the receiving signal by the
code sequence, and i thought to put a delay block (gr_delay) betwen the
spreading code and the division operator. Then I want to set the delay
with a close loop control using my output signal, but the problem is
that I’m not able to refresh the delay value, it stay only at the
initial value.I’ve tryied also to change it with a slide bar, but when
I’m going to change the value I find an error : TypeError: in method
‘gr_delay_sptr_set_delay’, argument 2 of type 'int’How can I make it
work? Or have you other ideas to syncronize the system?
Thank you all.
Mauro Bressan