Search code examples
pythonlinuxscriptingcentosnameerror

How to solve the NameError error in a python script ( on linux CentOS)


I am trying to make a Python script on Cent OS 8 but I constantly get this 'NameError' message and I just can't figure out what could be the problem. Here you'll see screenshots of both my script and the error message.

The error message

My script

Thanks in advance for the help.


Solution

  • You have to mention the full path of the file "sshdlog" like with open("full path to sshdlog file") as f or your script and sshdlog is in same directory.