{
  "id": 103396,
  "title": "Using zipfile.ZipFile to read the zip files",
  "url": "/competitions/kuzushiji-recognition/discussion/103396",
  "author_name": "Pavani",
  "post_date": "2019-08-09T01:52:06.154000",
  "votes": 1,
  "comment_count": 5,
  "views": 0,
  "content": "<p>Hi I tried the following command to read train_images.zip</p>\n\n<p>import zipfile</p>\n\n<p><strong>from subprocess import check_output</strong>\nprint(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))</p>\n\n<p>Dataset = \"train_images\"</p>\n\n<h1>Will unzip the files so that you can see them..</h1>\n\n<p>k =  zipfile.ZipFile(\"../input/\"+Dataset+\".zip\")</p>\n\n<p>However  I am getting the below error \nFileNotFoundError: [Errno 2] No such file or directory: '../input/train_images.zip'</p>\n\n<p>Has anyone tried this command please let me know?</p>",
  "messages": [
    {
      "id": 595494,
      "postDate": "2019-08-09T09:34:38.077Z",
      "content": "<p>These images are already extracted into ../input/train_images folder (as can be seen from <code>print(checkoutput([\"ls\", \"../input\"]).decode(\"utf8\"))</code> output above), so you don't need to use zipfile, it's possible to read them directly.</p>",
      "rawMarkdown": "These images are already extracted into ../input/train_images folder (as can be seen from ``print(checkoutput([\"ls\", \"../input\"]).decode(\"utf8\"))`` output above), so you don't need to use zipfile, it's possible to read them directly.",
      "votes": 3
    },
    {
      "id": 595245,
      "postDate": "2019-08-09T01:52:06.153Z",
      "content": "<p>Hi I tried the following command to read train_images.zip</p>\n\n<p>import zipfile</p>\n\n<p><strong>from subprocess import check_output</strong>\nprint(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))</p>\n\n<p>Dataset = \"train_images\"</p>\n\n<h1>Will unzip the files so that you can see them..</h1>\n\n<p>k =  zipfile.ZipFile(\"../input/\"+Dataset+\".zip\")</p>\n\n<p>However  I am getting the below error \nFileNotFoundError: [Errno 2] No such file or directory: '../input/train_images.zip'</p>\n\n<p>Has anyone tried this command please let me know?</p>",
      "rawMarkdown": "Hi I tried the following command to read train_images.zip\n\nimport zipfile\n\n**from subprocess import check_output**\nprint(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))\n\nDataset = \"train_images\"\n# Will unzip the files so that you can see them..\nk =  zipfile.ZipFile(\"../input/\"+Dataset+\".zip\")\n\nHowever  I am getting the below error \nFileNotFoundError: [Errno 2] No such file or directory: '../input/train_images.zip'\n\nHas anyone tried this command please let me know?",
      "votes": 1
    },
    {
      "id": 596495,
      "postDate": "2019-08-10T18:11:07.483Z",
      "content": "<p>I would want to evaluate each and every images in the zip files</p>",
      "rawMarkdown": "I would want to evaluate each and every images in the zip files",
      "replies": [
        {
          "id": 597117,
          "postDate": "2019-08-11T21:11:07.697Z",
          "content": "<p>I don't think I completely understand where your problem is exactly, but if you clarify I would be happy to help.</p>\n\n<p>The following code shows you the name of all the files in the training folder. Because the images are already extracted as Konstantin said in the comment above these are also all the files in the zipfile</p>\n\n<p>```\nimport os\nos.listdir(\"../input/train_images\")</p>\n\n<p>```</p>\n\n<p>now if you would like to open a specific image you could do it like this:</p>\n\n<p><code>\nfrom PIL import Image\nImage.open('../input/train_images/brsk005-041.jpg')\n</code></p>",
          "rawMarkdown": "I don't think I completely understand where your problem is exactly, but if you clarify I would be happy to help.\n\nThe following code shows you the name of all the files in the training folder. Because the images are already extracted as Konstantin said in the comment above these are also all the files in the zipfile\n\n```\nimport os\nos.listdir(\"../input/train_images\")\n\n```\n\nnow if you would like to open a specific image you could do it like this:\n\n```\nfrom PIL import Image\nImage.open('../input/train_images/brsk005-041.jpg')\n```",
          "votes": 1
        },
        {
          "id": 609561,
          "postDate": "2019-08-27T21:17:51.443Z",
          "content": "<p><a href=\"/christianwallenwein\">@christianwallenwein</a> this helps ! </p>",
          "rawMarkdown": "@christianwallenwein this helps ! ",
          "votes": 1
        }
      ]
    },
    {
      "id": 725434,
      "postDate": "2020-01-22T05:15:19.720Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 595494,
      "author_name": "Konstantin Lopukhin",
      "author_url": "",
      "post_date": "2019-08-09T09:34:38.077000",
      "content": "<p>These images are already extracted into ../input/train_images folder (as can be seen from <code>print(checkoutput([\"ls\", \"../input\"]).decode(\"utf8\"))</code> output above), so you don't need to use zipfile, it's possible to read them directly.</p>",
      "votes": 3,
      "replies": []
    },
    {
      "id": 596495,
      "author_name": "Pavani",
      "author_url": "",
      "post_date": "2019-08-10T18:11:07.483000",
      "content": "<p>I would want to evaluate each and every images in the zip files</p>",
      "votes": 0,
      "replies": [
        {
          "id": 597117,
          "author_name": "Chris Wallenwein",
          "author_url": "",
          "post_date": "2019-08-11T21:11:07.697000",
          "content": "<p>I don't think I completely understand where your problem is exactly, but if you clarify I would be happy to help.</p>\n\n<p>The following code shows you the name of all the files in the training folder. Because the images are already extracted as Konstantin said in the comment above these are also all the files in the zipfile</p>\n\n<p>```\nimport os\nos.listdir(\"../input/train_images\")</p>\n\n<p>```</p>\n\n<p>now if you would like to open a specific image you could do it like this:</p>\n\n<p><code>\nfrom PIL import Image\nImage.open('../input/train_images/brsk005-041.jpg')\n</code></p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 609561,
          "author_name": "Pavani",
          "author_url": "",
          "post_date": "2019-08-27T21:17:51.443000",
          "content": "<p><a href=\"/christianwallenwein\">@christianwallenwein</a> this helps ! </p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 725434,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-01-22T05:15:19.720000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "595494": "These images are already extracted into ../input/train_images folder (as can be seen from ``print(checkoutput([\"ls\", \"../input\"]).decode(\"utf8\"))`` output above), so you don't need to use zipfile, it's possible to read them directly.",
    "595245": "Hi I tried the following command to read train_images.zip\n\nimport zipfile\n\n**from subprocess import check_output**\nprint(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))\n\nDataset = \"train_images\"\n# Will unzip the files so that you can see them..\nk =  zipfile.ZipFile(\"../input/\"+Dataset+\".zip\")\n\nHowever  I am getting the below error \nFileNotFoundError: [Errno 2] No such file or directory: '../input/train_images.zip'\n\nHas anyone tried this command please let me know?",
    "596495": "I would want to evaluate each and every images in the zip files",
    "725434": ""
  }
}