報錯及解決
Traceback (most recent call last):
File "pwn.2.py", line 4, in <module>
conn = process("./hexcalc")
NameError: name 'process' is not defined
錯誤類型,變量沒有聲明。
解決方法:将檔案更名,不要用“pwn”的名字,不然會出現
Traceback (most recent call last):
File "pwn.py", line 2, in <module>
import pwn
問題。
另外報錯有回溯,根據回溯類型尋找錯誤
異常 | 描述 |
---|---|
NameError | 嘗試通路一個沒有申明的變量 |
ZeroDivisionError | 除數為 0 |
SyntaxError | 文法錯誤 |
IndexError | 索引超出序列範圍 |
KeyError | 請求一個不存在的字典關鍵字 |
IOError | 輸入輸出錯誤(比如你要讀的檔案不存在) |
AttributeError | 嘗試通路未知的對象屬性 |
引用源網站
python學習網站