Skip to content

ResourceWarning: unclosed file #534

Description

@djhenderson

Issuing either

py -Wdefault -m sqlite_utils insert dogs.db dogs dogs0.csv --csv
  [#############-----------------------]   36%
  [####################################]  100%C:\Users\Doug\AppData\Local\Programs\Python\Python311\Lib\site-packages\sqlite_utils\cli.py:1187: ResourceWarning: unclosed file <_io.TextIOWrapper name='dogs0.csv' encoding='utf-8-sig'>
  insert_upsert_implementation(
ResourceWarning: Enable tracemalloc to get the object allocation traceback

or

set pythonwarnings=default
sqlite-utils insert dogs.db dogs dogs0.csv --csv
  [#############-----------------------]   36%
  [####################################]  100%C:\Users\Doug\AppData\Local\Programs\Python\Python311\Lib\site-packages\sqlite_utils\cli.py:1187: ResourceWarning: unclosed file <_io.TextIOWrapper name='dogs0.csv' encoding='utf-8-sig'>
  insert_upsert_implementation(
ResourceWarning: Enable tracemalloc to get the object allocation traceback

exhibits a ResourceWarning indicating that the CSV file being loaded is not closed.

sqlite-utils --version
sqlite-utils, version 3.30
py --version
Python 3.11.2
Windows Version 10.0.19045 Build 19045
SQLite version 3.41.0 2023-02-21 18:09:37

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions