{"html_url": "https://github.com/simonw/sqlite-utils/issues/439#issuecomment-1155953345", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/439", "id": 1155953345, "node_id": "IC_kwDOCGYnMM5E5nLB", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-06-15T03:53:43Z", "updated_at": "2022-06-15T03:53:43Z", "author_association": "OWNER", "body": "I tried fixing this by using `.tell()` to read the file position as I was iterating through it:\r\n```diff\r\ndiff --git a/sqlite_utils/utils.py b/sqlite_utils/utils.py\r\nindex d2ccc5f..29ad12e 100644\r\n--- a/sqlite_utils/utils.py\r\n+++ b/sqlite_utils/utils.py\r\n@@ -149,10 +149,13 @@ class UpdateWrapper:\r\n def __init__(self, wrapped, update):\r\n self._wrapped = wrapped\r\n self._update = update\r\n+ self._tell = wrapped.tell()\r\n \r\n def __iter__(self):\r\n for line in self._wrapped:\r\n- self._update(len(line))\r\n+ tell = self._wrapped.tell()\r\n+ self._update(self._tell - tell)\r\n+ self._tell = tell\r\n yield line\r\n ```\r\nThis did not work - I get this error:\r\n\r\n```\r\n File \"/Users/simon/Dropbox/Development/sqlite-utils/sqlite_utils/utils.py\", line 206, in _extra_key_strategy\r\n for row in reader:\r\n File \"/Users/simon/Dropbox/Development/sqlite-utils/sqlite_utils/utils.py\", line 156, in __iter__\r\n tell = self._wrapped.tell()\r\nOSError: telling position disabled by next() call\r\n```\r\nIt looks like you can't use `.tell()` during iteration: https://stackoverflow.com/questions/29618936/how-to-solve-oserror-telling-position-disabled-by-next-call", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1250495688, "label": "Misleading progress bar against utf-16-le CSV input"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/444#issuecomment-1155966234", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/444", "id": 1155966234, "node_id": "IC_kwDOCGYnMM5E5qUa", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-06-15T04:18:05Z", "updated_at": "2022-06-15T04:18:05Z", "author_association": "OWNER", "body": "I'm going to push a branch with my not-yet-working code (which does at least include a test).", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1271426387, "label": "CSV `extras_key=` and `ignore_extras=` equivalents for CLI tool"}, "performed_via_github_app": null}