Fixed 2 problems on Jython and older POSIX environments

Fixed 2 problems on Jython and older POSIX environments. This is a patch for #849.

1. Stop using `os.O_NOFOLLOW` since it might not exist if the platform is not GNU or POSIX prior to 2008.
2. Jython 2.5.x/2.7.x cannot handle directories by `os.open()`