From: Lukasz Kosewski Date: Sun, 10 Jan 2010 08:57:42 +0000 (-0500) Subject: cmd-index.py: Retry os.open without O_LARGEFILE if not supported. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=caabf81997973c7c4eceb0b97e4d21c88092fb18;p=packages%2Fb%2Fbup.git cmd-index.py: Retry os.open without O_LARGEFILE if not supported. Python under Cygwin doesn't have os.O_LARGEFILE, so if we receive an 'AttributeError' exception trying to open something, just remove O_LARGEFILE and try again. --- diff --git a/cmd-index.py b/cmd-index.py index ef596b7..e3d1b7b 100755 --- a/cmd-index.py +++ b/cmd-index.py @@ -6,7 +6,10 @@ from helpers import * class OsFile: def __init__(self, path): self.fd = None - self.fd = os.open(path, os.O_RDONLY|os.O_LARGEFILE|os.O_NOFOLLOW) + try: + self.fd = os.open(path, os.O_RDONLY|os.O_LARGEFILE|os.O_NOFOLLOW) + except AttributeError: + self.fd = os.open(path, os.O_RDONLY|os.O_NOFOLLOW) #self.st = os.fstat(self.fd) def __del__(self):