{"html_url": "https://github.com/simonw/sqlite-utils/issues/503#issuecomment-1291124413", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/503", "id": 1291124413, "node_id": "IC_kwDOCGYnMM5M9P69", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-10-25T20:47:34Z", "updated_at": "2022-10-25T20:47:34Z", "author_association": "OWNER", "body": "TIL about this: https://til.simonwillison.net/python/os-remove-windows", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1423000702, "label": "test_recreate failing on Windows Python 3.11"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/503#issuecomment-1291122389", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/503", "id": 1291122389, "node_id": "IC_kwDOCGYnMM5M9PbV", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-10-25T20:45:43Z", "updated_at": "2022-10-25T20:45:43Z", "author_association": "OWNER", "body": "That fixed it.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1423000702, "label": "test_recreate failing on Windows Python 3.11"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/503#issuecomment-1291115986", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/503", "id": 1291115986, "node_id": "IC_kwDOCGYnMM5M9N3S", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-10-25T20:39:24Z", "updated_at": "2022-10-25T20:39:24Z", "author_association": "OWNER", "body": "Used `psutil` to confirm that closing a SQLite connection closes the underlying file: https://til.simonwillison.net/python/too-many-open-files-psutil \r\n```pycon\r\n>>> import psutil\r\n>>> import sqlite3\r\n>>> for f in psutil.Process().open_files(): print(f)\r\n... \r\n>>> sqlite3.connect(\"/tmp/blah.db\")\r\n\r\n>>> conn = _\r\n>>> for f in psutil.Process().open_files(): print(f)\r\n... \r\npopenfile(path='/private/tmp/blah.db', fd=3)\r\n>>> conn.close()\r\n>>> for f in psutil.Process().open_files(): print(f)\r\n... \r\n>>> \r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1423000702, "label": "test_recreate failing on Windows Python 3.11"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/503#issuecomment-1291111357", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/503", "id": 1291111357, "node_id": "IC_kwDOCGYnMM5M9Mu9", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-10-25T20:36:06Z", "updated_at": "2022-10-25T20:36:06Z", "author_association": "OWNER", "body": "... or maybe Windows doesn't like attempts to remove a file that the process has opened?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1423000702, "label": "test_recreate failing on Windows Python 3.11"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/503#issuecomment-1291103021", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/503", "id": 1291103021, "node_id": "IC_kwDOCGYnMM5M9Kst", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-10-25T20:32:01Z", "updated_at": "2022-10-25T20:32:01Z", "author_association": "OWNER", "body": "This test reliably fails on Windows with Python 3.11.\r\n\r\nI'm going to skip the test for the moment to get back to green CI... but I'll leave this issue open. This is definitely concerning, I just don't have the right local environment to solve this at the moment.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1423000702, "label": "test_recreate failing on Windows Python 3.11"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/503#issuecomment-1291093581", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/503", "id": 1291093581, "node_id": "IC_kwDOCGYnMM5M9IZN", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-10-25T20:23:00Z", "updated_at": "2022-10-25T20:23:00Z", "author_association": "OWNER", "body": "I'm not hugely happy with my fix there:\r\n\r\nhttps://github.com/simonw/sqlite-utils/blob/c5d7ec1dd71fa1dce829bc8bb82b639018befd63/sqlite_utils/db.py#L321-L328\r\n\r\nThe problem here was that in the case where the `os.remove()` failed the `self.conn` property was NOT being set to a valid connection - which caused `__repr__` to fail later on.\r\n\r\nSo now I catch the `os.remove()` error, set `self.conn` to a memory connection, then raise the error again.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1423000702, "label": "test_recreate failing on Windows Python 3.11"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/503#issuecomment-1291088108", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/503", "id": 1291088108, "node_id": "IC_kwDOCGYnMM5M9HDs", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-10-25T20:17:36Z", "updated_at": "2022-10-25T20:17:36Z", "author_association": "OWNER", "body": "Now `mypy` is failing:\r\n\r\n```\r\nsqlite_utils/db.py:474: error: Item \"None\" of \"Optional[Any]\" has no attribute \"execute\"\r\nsqlite_utils/db.py:476: error: Item \"None\" of \"Optional[Any]\" has no attribute \"execute\"\r\nsqlite_utils/db.py:486: error: Item \"None\" of \"Optional[Any]\" has no attribute \"executescript\"\r\nsqlite_utils/db.py:603: error: Item \"None\" of \"Optional[Any]\" has no attribute \"__enter__\"\r\nsqlite_utils/db.py:603: error: Item \"None\" of \"Optional[Any]\" has no attribute \"__exit__\"\r\nsqlite_utils/db.py:604: error: Item \"None\" of \"Optional[Any]\" has no attribute \"execute\"\r\nsqlite_utils/db.py:607: error: Item \"None\" of \"Optional[Any]\" has no attribute \"execute\"\r\nsqlite_utils/db.py:1082: error: Item \"None\" of \"Optional[Any]\" has no attribute \"__enter__\"\r\nsqlite_utils/db.py:1082: error: Item \"None\" of \"Optional[Any]\" has no attribute \"__exit__\"\r\nsqlite_utils/db.py:1083: error: Item \"None\" of \"Optional[Any]\" has no attribute \"cursor\"\r\nsqlite_utils/db.py:1155: error: Item \"None\" of \"Optional[Any]\" has no attribute \"enable_load_extension\"\r\nsqlite_utils/db.py:1156: error: Item \"None\" of \"Optional[Any]\" has no attribute \"load_extension\"\r\nFound 12 errors in 1 file (checked 51 source files)\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1423000702, "label": "test_recreate failing on Windows Python 3.11"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/503#issuecomment-1291083188", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/503", "id": 1291083188, "node_id": "IC_kwDOCGYnMM5M9F20", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-10-25T20:12:52Z", "updated_at": "2022-10-25T20:12:52Z", "author_association": "OWNER", "body": "Failed again, but just noticed this: https://github.com/simonw/sqlite-utils/actions/runs/3323932266/jobs/5494890223\r\n\r\n```\r\n> Database(filepath, recreate=True)[\"t2\"].insert({\"foo\": \"bar\"})\r\n\r\ntests\\test_recreate.py:31: \r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\n\r\nself = <[AttributeError(\"'Database' object has no attribute 'conn'\") raised in repr()] Database object at 0x29fc125aa90>\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1423000702, "label": "test_recreate failing on Windows Python 3.11"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/503#issuecomment-1291076031", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/503", "id": 1291076031, "node_id": "IC_kwDOCGYnMM5M9EG_", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-10-25T20:06:28Z", "updated_at": "2022-10-25T20:06:28Z", "author_association": "OWNER", "body": "This is the failing test: https://github.com/simonw/sqlite-utils/blob/7b2d1c0ffd0b874e280292b926f328a61cb31e2c/tests/test_recreate.py#L21-L32\r\n\r\nI'm going to try a different way of creating the temporary file: https://docs.pytest.org/en/7.1.x/how-to/tmp_path.html", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1423000702, "label": "test_recreate failing on Windows Python 3.11"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/503#issuecomment-1291071627", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/503", "id": 1291071627, "node_id": "IC_kwDOCGYnMM5M9DCL", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-10-25T20:02:18Z", "updated_at": "2022-10-25T20:02:18Z", "author_association": "OWNER", "body": "Passes on Windows with other Python versions for some reason.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1423000702, "label": "test_recreate failing on Windows Python 3.11"}, "performed_via_github_app": null}