NameError: name 'host' is not defined

后端 未结 3 1860
猫巷女王i
猫巷女王i 2021-01-28 17:23

I\'m new in python programming. When i try running a simple python script i get error like this in my terminal

root@bt:/tmp# python code.py
Traceback (most recen         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-28 18:13

    it seem that your script expects an input parameter

    host=str(sys.argv[1])

    in case that parameter is not supplied, as shown in your post, an exception raised and been caught in the except clause before the host parameter was defined

    try to declare host before the try/except block

提交回复
热议问题