it fixes the issue The path given to open should be relative to the current working directory, the directory from which you run the script. So the above example will only work if you run it from the cgi-bin directory. A simple solution would be to make your path relative to the script. One possible solution.
from os import path
basepath = path.dirname(__file__)
filepath = path.abspath(path.join(basepath, "..", "..", "fileIwantToOpen.txt"))
f = open(filepath, "r")
Batch File: Error in relative path , one level up from the current directory
fixed the issue. Will look into that further Your attempt to use %~1 to go up one level in the directory structure is inventive and totally invalid syntax. The proper syntax is just as simple - use ..\. A leading \ is not required because %~dp0 ends with a \.
To fix the issue you can do The answer is in ring bearer comment. I will just mark it here so that other people having the same issue can easily take the answer home. use find command as find . -name file_name