python项目打包成so加密文件后运行报错:expected unicode ,get datetime.datetime

报错信息:
在这里插入图片描述
之前碰到过类似错误,原因是在定义函数入参时指定类型和实际传参类型不一致,这种情况python项目运行没有问题,但是加密成so文件后会报错,去除指定类型即可;但是这次我的函数里面没有制定参数数据类型,get_device_control_data的实际入参类型都是字符串,代码如下:

def get_device_control_data(sn, start_time, end_time, device_type):
    print(165, type(start_time))
    start_time = datetime.strptime(start_time, '%Y-%m-%d %H:%M:%S')
    end_time = datetime.strptime(end_time, '%Y-%m-%d %H:%M:%S')
    sum_hours = (end_time - start_time).days * 24 + (end_time - start_time).seconds // 3600
    # print(sum_hours)
    res = get_run_axisdatas(sum_hours, str(start_time), str(end_time), sn, device_type)
    print(171, type(start_time))
    if len(res[1]) == 0:
        type_status = [3]
    else:
        type_status = [3 for i in range(len(res[1]))]
    if device_type == 'VDM':
        Signal_datas = {
            'datas': [
                {
                    'SignalsName': 'vdm状态',
                    'TimeTag': str(start_time)[:10] + '到' + str(end_time)[:10],
                    'type': type_status,
                    'axistype': 2,
                    'axisdatas': res[0],
                    'axisLegend': res[1],
                    'colors': res[2],
                    'threshold': [None for i in range(len(res[1]))],
                    'unit': [None for i in range(len(res[1]))]
                },
                {
                    'SignalsName': 'tsp值',
                    'type': [1],
                    'axistype': 1,
                    'axisdatas': get_value_tsp_axisdatas(sum_hours, start_time, end_time, sn),
                    'axisLegend': ['tsp值'],
                    'colors': [[[0, 246, 255, 1]]],
                    'threshold': [None],
                    'unit': ['ug/m3']
                }

            ]
        }
        print(203, type(start_time))
    elif device_type == 'TSP':
        Signal_datas = {
            'datas': [
                # {
                #     'SignalsName': 'tsp状态',
                #     'type': [3 for i in range(len(res[1]))],
                #     'axistype': 2,
                #     'axisdatas': res[0],
                #     'axisLegend': res[1],
                #     'colors': res[2],
                #     'threshold': [None for i in range(len(res[1]))],
                #     'unit': [None for i in range(len(res[1]))]
                # },
                {
                    'SignalsName': 'tsp值',
                    'TimeTag': str(start_time)[:10] + '到' + str(end_time)[:10],
                    'type': [1],
                    'axistype': 1,
                    'axisdatas': get_value_tsp_axisdatas(sum_hours, start_time, end_time, sn),
                    'axisLegend': ['tsp值(ug/m3)'],
                    'colors': [[[0, 246, 255, 1]]],
                    'threshold': [None],
                    'unit': ['ug/m3']
                }

            ]
        }
    elif device_type == 'WP':
        Signal_datas = {
            'datas': [
                {
                    'SignalsName': '雾炮状态',
                    'TimeTag': str(start_time)[:10] + '到' + str(end_time)[:10],
                    'type': type_status,
                    'axistype': 2,
                    'axisdatas': res[0],
                    'axisLegend': res[1],
                    'colors': res[2]
                }

            ]
        }
    elif device_type == 'MPT':
        Signal_datas = {
            'datas': [
                {
                    'SignalsName': '堆取料机状态',
                    'TimeTag': str(start_time)[:10] + '到' + str(end_time)[:10],
                    'type': type_status,
                    'axistype': 2,
                    'axisdatas': res[0],
                    'axisLegend': res[1],
                    'colors': res[2],
                    'threshold': [None for i in range(len(res[1]))],
                    'unit': [None for i in range(len(res[1]))]
                }]}
    elif device_type == 'SG':
        Signal_datas = {
            'datas': [
                {
                    'SignalsName': '喷水桩状态',
                    'TimeTag': str(start_time)[:10] + '到' + str(end_time)[:10],
                    'type': type_status,
                    'axistype': 2,
                    'axisdatas': res[0],
                    'axisLegend': res[1],
                    'colors': res[2],
                    'threshold': [None for i in range(len(res[1]))],
                    'unit': [None for i in range(len(res[1]))]
                }]}
    elif device_type == 'WM':
        Signal_datas = {
            'datas': [
                {
                    'SignalsName': '洗车机状态',
                    'TimeTag': str(start_time)[:10] + '到' + str(end_time)[:10],
                    'type': type_status,
                    'axistype': 2,
                    'axisdatas': res[0],
                    'axisLegend': res[1],
                    'colors': res[2],
                    'threshold': [None for i in range(len(res[1]))],
                    'unit': [None for i in range(len(res[1]))]
                }]}
    else:
        pass
    return Signal_datas

破案了,我改完代码之后删除so文件,重新打包生成so文件;但是启动服务的终端没有关闭,里面运行的文件一直是被删除的文件,而不是最新的文件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值