How to detect the terminal that is running python?
Question: I've already tried sys.platform, platform.system() and os.name but none of
them return something related to cygwin (I always get win32, Windows and nt as
output). Maybe because my python was installed on windows (8.1) and not
through cygwin. I need to detect if my python file is being executed by cygwin
or cmd.


Answer: Cygwin uses Linux-style paths; thus you might be able to check the path
separator:

    
    
    import sys
    import os.path
    
    def running_cygwin():
        return sys.platform == 'win32' and os.path.sep == '/'
    

(I don't have a Cygwin here, so this is untested.)

