# Buggy code
def __init__(self, zipfile, entry=""):
    """
    Create a new path pointer pointing at the specified entry
    in the given zipfile.

    :raise IOError: If the given zipfile does not exist, or if it
    does not contain the specified entry.
    """
    if isinstance(zipfile, string_types):
        zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile))

    # Normalize the entry string, it should be relative:
    entry = normalize_resource_name(entry, True, "/").lstrip("/")

    # Check that the entry exists:
    if entry != ".":
        try:
            zipfile.getinfo(entry)
        except Exception:
            # Sometimes directories aren't explicitly listed in
            # the zip file.  So if `entry` is a directory name,
            # then check if the zipfile contains any files that
            # are under the given directory.
            if entry.endswith("/") and [
                n for n in zipfile.namelist() if n.startswith(entry)
            ]:
                pass  # zipfile contains a file in that directory.
            else:
                # Otherwise, complain.
                raise IOError(
                    "Zipfile %r does not contain %r" % (zipfile.filename, entry)
                )
    self._zipfile = zipfile
    self._entry = entry


# Traceback (OSError)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Apps\Tools\python\conda3\envs\nlp\lib\site-packages\nltk\corpus\reader\twitter.py", line 74, in __init__
CorpusReader.__init__(self, root, fileids, encoding)
File "C:\Apps\Tools\python\conda3\envs\nlp\lib\site-packages\nltk\corpus\reader\api.py", line 82, in __init__
root = ZipFilePathPointer(zipfile, zipentry)
File "C:\Apps\Tools\python\conda3\envs\nlp\lib\site-packages\nltk\compat.py", line 221, in _decorator
return init_func(*args, **kwargs)
File "C:\Apps\Tools\python\conda3\envs\nlp\lib\site-packages\nltk\data.py", line 506, in __init__
(zipfile.filename, entry))
OSError: Zipfile 'C:\\Projects\\mfd\\nlp\\twitter_samples.zip' does not contain '.'

# Fixed code
def __init__(self, zipfile, entry=""):
    """
    Create a new path pointer pointing at the specified entry
    in the given zipfile.

    :raise IOError: If the given zipfile does not exist, or if it
    does not contain the specified entry.
    """
    if isinstance(zipfile, string_types):
        zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile))

    # Check that the entry exists:
    if entry:
        # Normalize the entry string, it should be relative:
        entry = normalize_resource_name(entry, True, "/").lstrip("/")

        try:
            zipfile.getinfo(entry)
        except Exception:
            # Sometimes directories aren't explicitly listed in
            # the zip file.  So if `entry` is a directory name,
            # then check if the zipfile contains any files that
            # are under the given directory.
            if entry.endswith("/") and [
                n for n in zipfile.namelist() if n.startswith(entry)
            ]:
                pass  # zipfile contains a file in that directory.
            else:
                # Otherwise, complain.
                raise IOError(
                    "Zipfile %r does not contain %r" % (zipfile.filename, entry)
                )
    self._zipfile = zipfile
    self._entry = entry