Dear KNIMEer:
Today, I got an python "socket.error: [Errno 10054]" when I run a python script in Knime3.3.1 version:
This python script have been successfully run in another Knime Workflow:
# Copy input to output
output_table = input_table.copy()
#output_table = input_table[input_table['game_type']==0]
import datetime,time
#transform timestamp to datetine
def timestamp_datetime(value):
import time
format = '%Y-%m-%d'
#format = '%Y-%m-%d %H:%M:%S'
#value Timestamp like:1460073600.0
value = time.localtime(value)
dt = time.strftime(format,value)
return dt
#transform datetine to timestamp
def datetime_timestamp(dt):
import time
#time.strptime(dt,'%Y-%m-%d %H:%M:%S')
s = time.mktime(time.strptime(dt,'%Y-%m-%d %H:%M:%S'))
return int(s)
# get today
today = datetime.date.today().strftime("%Y-%m-%d")
day_30 = int(time.mktime(time.strptime(today,'%Y-%m-%d'))) - 30*86400
day_14 = int(time.mktime(time.strptime(today,'%Y-%m-%d'))) - 14*86400
day_7 = int(time.mktime(time.strptime(today,'%Y-%m-%d'))) - 7*86400
output_table['begintime_format'] = output_table['begin_time'].apply(lambda x: timestamp_datetime(x))
output_table['endtime_format'] = output_table['end_time'].apply(lambda x: timestamp_datetime(x))
The input data is like below:
,banker,begin_time,cur_round,desk_id,end_time,game_type,remain_round,advanced_set,allow_negative,auto_settlement,base_gold,chu_pai_time,dian_gang_hua,ding_que,enter_gold_low_limit,fan_checked,fan_num,game_type,gang_bao,hai_di_lao,is_apply,jin_gou_diao,lai_zi,ma_checked,ma_max_num,ma_type,que_feng,que_men_checked,settlement_round,swap_mj,table_round,zi_mo_jia_di 0,67515,1487509300.83,4,69611,1487509372.54,1,12,true,,false,2,,0.0,false,,false,0,1,,false,0,false,true,true,8,2,true,,,false,16,false
But it return below eeror:
ERROR Python Script (1⇒1) 2:9 Execute failed: Runtime class of object "15.0" (index 11) in row "77747" is Number (double) and does not comply with its supposed superclass String
ERROR PythonKernel Traceback (most recent call last):
File "D:\Program Files\KNIME\plugins\org.knime.python_3.3.0.v201611242050\py\PythonKernel.py", line 1047, in <module>
run()
File "D:\Program Files\KNIME\plugins\org.knime.python_3.3.0.v201611242050\py\PythonKernel.py", line 161, in run
write_message(table)
File "D:\Program Files\KNIME\plugins\org.knime.python_3.3.0.v201611242050\py\PythonKernel.py", line 266, in write_message
write_size(len(message_string))
File "D:\Program Files\KNIME\plugins\org.knime.python_3.3.0.v201611242050\py\PythonKernel.py", line 260, in write_size
_connection.sendall(struct.pack('>L', size))
File "C:\ProgramData\Anaconda2\lib\socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 10054]
However I can not find any kind of abnormal in row '77747' as below:
100007231 1.48832646548E9 2 54279 1.48832664059E9 1 2 true ? true 1 ? 0.0 false ? false 0 1 true false 0 false true true 8 2 true ? 4.0 false 99 false 11981 1.47571363177E9 3 117401 1.47571383511E9 1 3 true ? ? 1 15.0 ? false 0.0 false 0 1 ? ? 0 ? false false 2 1 false false ? ? 4 false
what is wrong in this suitation?How can i fix it.
The Python Version is 2.7.13.