As I code Python, I find myself falling back on Bash to handle basic OS tasks. How do you gurus deal with Python --> Bash conflicts?
For example, if I wish to test if a file exists, I might do test = Popen('[ -f file-i-want-to-test-for ]') But the moment I invoke Bash for a test, I must deal with the fact that Bash returns a zero for true and a non-zero for false. But in Python, zero is false and non-zero is true. So if the file exists, the variable 'test' will be zero since that is what was returned by Bash. But if I want to test the variable for the existence of the file, I have to test the opposite: 'if not test:' because Python sees the zero as False. Does it become second nature to work with these conflicts? Or do you find it more expedient bypass the OS shell and work almost exclusively with Python? Ray _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor