def get_data(self, space, filename): filename = self._find_relative_path(filename) w = space.wrap try: zip_file = RZipFile(self.filename, 'r') try: data = zip_file.read(filename) finally: zip_file.close() return w(data) except (KeyError, OSError): raise OperationError(space.w_IOError, space.wrap("Error reading file"))
def get_data(self, space, filename): filename = self._find_relative_path(filename) w = space.wrap try: zip_file = RZipFile(self.filename, 'r') try: data = zip_file.read(filename) finally: zip_file.close() return w(data) except (KeyError, OSError): raise OperationError(space.w_IOError, space.wrap("Error reading file"))
def one(): rzip = RZipFile(zipname, "r", compression) info = rzip.getinfo('one') return (info.date_time[0] == year and rzip.read('one') == 'stuff' and rzip.read('three') == 'hello, world')
def one(): rzip = RZipFile(zipname, "r", compression) info = rzip.getinfo("one") return info.date_time[0] == year and rzip.read("one") == "stuff\n" and rzip.read("three") == "hello, world"