Gnarlodious
2/13/2010 8:35:00 PM
On Feb 13, 1:17 pm, "Diez B. Roggisch" wrote:
> However, maybe
>
> if os.isatty(sys.stdout.fileno()):
OK, this works in Python 2:
#!/usr/bin/python
import sys, os
if __name__=="__main__":
if os.isatty(sys.stdout.fileno()):
print "Terminal"
else:
print "Content-type:text/html\n\nBROWSER"
likewise in Python3:
#!/usr/local/bin/python3.1
import sys, os
if __name__=="__main__":
if os.isatty(sys.stdout.fileno()):
print("Terminal")
else:
print("Content-type:text/html\n\nBROWSER")
Thank you, always impressed with the fast help here.
-- Gnarlie