Python cannot open file
Question: 
    #!/usr/bin/python 
    data = open("/home/mia/Desktop/results/all-nodup.txt", "r")
    fd = open("/home/mia/Desktop/results/all-filter.txt", "w")
    
    last_time = 0.0
    last_ip = None
    last_hash = None
    row = data.read()
    
    for line in row:
          timestamp, ip, hash_value = line.split()
    
          if ip==last_ip and hash_value==last_hash:  
    
               if float(timestamp) - float(last_time) >= 5.0:
                 fd.write("%s\t%s\t%s\n" % (str(timestamp), str(ip), str(hash_value))) 
                 last_time, last_ip, last_hash = timestamp, ip, hash_value
          else:
               fd.write("%s\t%s\t%s\n" % (str(timestamp), str(ip), str(hash_value)))   
               last_time, last_ip, last_hash = timestamp, ip, hash_value
    
    fd.close()
    

This is my entire code, I go to results/ directory to run: `python filter.py`
I got an error message: `python: can't open file 'filter.py': [Errno 2] No
such file or directory`

But every other scripts can be executed, so python works fine, maybe I should
import something in this case?


Answer: python can't even find your filter.py script file, so changing your code is
useless. To fix that you'll either need to:

  * put `filter.py` inside `results/` directory
  * use absolute path, e.g. `python /path/to/script/filter.py`
  * figure out the correct relative path, e.g. `python ../../blah/filter.py`
  * put the path where filter.py resides into your PATH variable

