Skip to content

Commit

Permalink
remove unicodecsv (#1804)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Sep 9, 2024
1 parent 1429a81 commit 094619b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ ENV TZ=${TZ} \
python3-greenlet \
python3-pip \
python3-tz \
python3-unicodecsv \
python3-yaml \
${ADD_DEB_PACKAGES}"

Expand Down
8 changes: 4 additions & 4 deletions pygeoapi/formatter/csv_.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@
#
# =================================================================

import csv
import io
import logging

import unicodecsv as csv

from pygeoapi.formatter.base import BaseFormatter, FormatterSerializationError

LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -83,10 +82,11 @@ def write(self, options: dict = {}, data: dict = None) -> str:
# TODO: implement wkt geometry serialization
LOGGER.debug('not a point geometry, skipping')

print("JJJ", fields)
LOGGER.debug(f'CSV fields: {fields}')

try:
output = io.BytesIO()
output = io.StringIO()
writer = csv.DictWriter(output, fields)
writer.writeheader()

Expand All @@ -101,7 +101,7 @@ def write(self, options: dict = {}, data: dict = None) -> str:
LOGGER.error(err)
raise FormatterSerializationError('Error writing CSV output')

return output.getvalue()
return output.getvalue().encode('utf-8')

def __repr__(self):
return f'<CSVFormatter> {self.name}'
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ requests
shapely
SQLAlchemy<2.0.0
tinydb
unicodecsv

0 comments on commit 094619b

Please sign in to comment.