async handler deleted by the wrong thread in django

Posted by user3480706 on Stack Overflow See other posts from Stack Overflow or by user3480706
Published on 2014-08-21T16:17:34Z Indexed on 2014/08/21 16:19 UTC
Read the original article Hit count: 572

Filed under:
|
|

I'm run this algorithm in my django application.when i run several time from my GUI django local server will stopped and i got this error

Exception RuntimeError: RuntimeError('main thread is not in main loop',) in > ignored Tcl_AsyncDelete: async handler deleted by the wrong thread Aborted (core dumped)

code

print "Learning the sin function"
network =MLP.MLP(2,10,1)

samples = np.zeros(2000, dtype=[('x',  float, 1), ('y', float, 1)])
samples['x'] = np.linspace(-5,5,2000)
samples['y'] = np.sin(samples['x'])
#samples['y'] = np.linspace(-4,4,2500)

for i in range(100000):
    n = np.random.randint(samples.size)
    network.propagate_forward(samples['x'][n])
    network.propagate_backward(samples['y'][n])

plt.figure(figsize=(10,5))
# Draw real function

x = samples['x']
y = samples['y'] 
#x=np.linspace(-6.0,7.0,50)
plt.plot(x,y,color='b',lw=1)


samples1 = np.zeros(2000, dtype=[('x1',  float, 1), ('y1', float, 1)])
samples1['x1'] = np.linspace(-4,4,2000)
samples1['y1'] = np.sin(samples1['x1'])

# Draw network approximated function
for i in range(samples1.size):
    samples1['y1'][i] = network.propagate_forward(samples1['x1'][i])


plt.plot(samples1['x1'],samples1['y1'],color='r',lw=3)
plt.axis([-2,2,-2,2])
plt.show()
plt.close()
return HttpResponseRedirect('/charts/charts') 

how can i fix this error ?need a quick help

© Stack Overflow or respective owner

Related posts about python

Related posts about django