Python异常处理
来源:互联网 发布:淘宝怎么花钱推广 编辑:程序博客网 时间:2024/06/02 02:15
1.报错:
Traceback (most recent call last):
File "C:\Python33\jiyu\source\SimulationModule\SimulationProcess.py", line 198, in <module>
task1.actor = schedule_agent.ResourceAllocate("task1","all",current_time,new_case)
File "C:\Python33\jiyu\source\SimulationModule\AllocationAlgorithms.py", line 864, in ResourceAllocate
max_Q = -1*sys.maxint
AttributeError: 'module' object has no attribute 'maxint'
解决办法:
对报错的那行代码做如下修改
try:
max_Q = -1*sys.maxint
except:
return False
2.再报错:
Traceback (most recent call last):
File "C:\Python33\jiyu\source\SimulationModule\SimulationProcess.py", line 9, in <module>
from AllocationAlgorithms import Random_Allocation, SWL_Allocation, SPT_Allocation, SCT_Allocation,Q_Learning_S_All_r1,Q_Learning_Table_Allocation,Q_Learning_Allocation_With_Workload,Q_Learning_Allocation_With_Workload_V2,Q_Learning_Allocation_With_Workload_V2_SC
File "C:\Python33\jiyu\source\SimulationModule\AllocationAlgorithms.py", line 865
max_Q = -1*sys.maxint
^
TabError: inconsistent use of tabs and spaces in indentation
这个是外用文本编辑器对于tab 和 空格的定义问题,python里对于缩进有统一的要求,一般都用4个空格代替tab
解决办法:
a. 英文版,notepad++ --> view --> show symbol --> show all character
b.中文版, notepad++ --> 视图 --> 显示符号 --> 显示所有符号。
显示所有字符后,把tab都替换成4个空格。
- Python异常和异常处理
- python异常处理
- Python异常处理
- python 异常处理
- python异常处理
- python如何处理异常
- python之异常处理
- python异常处理
- python异常处理
- Python异常处理
- python异常处理
- python的异常处理
- python的异常处理
- python 异常处理
- python 异常处理
- python 异常处理
- Python异常处理
- Python异常处理
- 沉没成本和机会成本
- 集合加法
- ie兼容的摘记
- addObserverForName:object:queue:usingBlock:
- RTCP包中的NTP Time
- Python异常处理
- 如何给宝宝起名字
- Oracle11g与Mysql透明网关配置记录
- ie兼容记录
- Android Activity启动模式
- javascript数组操作(创建、元素删除、数组的拷贝)
- 介绍一下你们大学食堂啊!!!
- xmmintrin.h与SSE指令集
- c位运算