Skip to content

DeprecationWarning: ijson opening file in text mode instead of binary mode #7

@qloridant

Description

@qloridant

Context

A warning is raised when using the geojsplit package. This happens when using a file as input.

Example of code raising the warning :
geojson = geojsplit.GeoJSONBatchStreamer(file_path)

Version

Python==3.9.7

geojsplit==0.1.2
ijson=2.6.1

Stack

  ijson/compat.py:48:DeprecationWarning: 
  ijson works by reading bytes, but a string reader has been given instead. This
  probably, but not necessarily, means a file-like object has been opened in text
  mode ('t') rather than binary mode ('b').
  
  An automatic conversion is being performed on the fly to continue, but on the
  other hand this creates unnecessary encoding/decoding operations that decrease
  the efficiency of the system. In the future this automatic conversion will be
  removed, and users will receive errors instead of this warning. To avoid this
  problem make sure file-like objects are opened in binary mode instead of text
  mode.
  
    warnings.warn(_str_vs_bytes_warning, DeprecationWarning)

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