To toggle the hidden status of a file on Mac OSX in python, I use the following code:
st = os.stat(file_path)
os.chflags(file_path, st.st_flags ^ stat.UF_HIDDEN)
This works perfectly for "files" but does not work for "folders". Note that I am not talking about files or folders that start with "."
EDIT: The above code works for both files and folder, I made a mistake in my assumption...