Python线程 - "进程以退出代码-1073741819(0xC0000005)"完成

时间:2018-05-10 22:40:32

标签: python multithreading python-3.x python-multithreading

我正在尝试在python 3.5中实现线程但是无法正常工作。运行脚本时,该过程以退出代码-1073741819(0xC0000005)结束。

以下是代码:

if __name__ == "__main__":
    # divide training and testing data
    index70 = pd.read_csv('F:/dataset/rain_data/index70.csv', header=None)
    index70 = np.array(index70.values[0])
    # print(len(index70))
    # print(index70.values[0][5])

    # read netcdf
    netcdf_entire_dataset = Dataset("F:/dataset/entire_dataset.nc", "r")
    rain_models = netcdf_entire_dataset.variables['rain_models']

    data_table_t1 = np.zeros((101, 10))
    data_table_t5 = np.zeros((101, 10))
    data_table_t10 = np.zeros((101, 10))
    data_table_t20 = np.zeros((101, 10))
    data_table_t40 = np.zeros((101, 10))
    data_table_t80 = np.zeros((101, 10))

    threading.Thread(target=calculation, args=(0,)).start()
    threading.Thread(target=calculation, args=(6,)).start()
    threading.Thread(target=calculation, args=(12,)).start()
    threading.Thread(target=calculation, args=(18,)).start()

    np.savetxt('threshold_'+str(1)+'.csv', data_table_t1, delimiter=',', fmt='%10.5f')
    np.savetxt('threshold_' + str(5) + '.csv', data_table_t5, delimiter=',', fmt='%10.5f')
    np.savetxt('threshold_' + str(10) + '.csv', data_table_t10, delimiter=',', fmt='%10.5f')
    np.savetxt('threshold_' + str(20) + '.csv', data_table_t20, delimiter=',', fmt='%10.5f')
    np.savetxt('threshold_' + str(40) + '.csv', data_table_t40, delimiter=',', fmt='%10.5f')
    np.savetxt('threshold_' + str(80) + '.csv', data_table_t80, delimiter=',', fmt='%10.5f')

计算方法有多个嵌套for循环。该线程适用于小例子,但不适用于此方法。

输出: 处理完成,退出代码为-1073741819(0xC0000005)

0 个答案:

没有答案