Install & Compatibility
Where this runs
tested against v0.14.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.4s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
csv
✓ import unicodecsv as csv
reader
✓ from unicodecsv import reader
writer
✓ from unicodecsv import writer
Demonstrates writing and reading Unicode data using `unicodecsv` with `io.BytesIO` to simulate file operations. This library is specifically designed for Python 2 to correctly handle Unicode CSV files.
import unicodecsv as csv
import io
# This example demonstrates unicodecsv in a Python 2-like environment.
# In Python 3, the standard `csv` module handles unicode correctly.
# Simulate a file-like object for writing (expecting bytes)
output_buffer = io.BytesIO()
writer = csv.writer(output_buffer, encoding='utf-8')
writer.writerow(['héllø', 'wørld', '😊'])
writer.writerow(['line 2', 'value 2', 'another'])
# Get the byte content written to the buffer
csv_bytes = output_buffer.getvalue()
print("unicodecsv: Written CSV bytes (Python 2 style):")
print(csv_bytes.decode('utf-8')) # Decode for printing in Python 3 console
# Simulate a file-like object for reading
input_buffer = io.BytesIO(csv_bytes)
reader = csv.reader(input_buffer, encoding='utf-8')
print("\nunicodecsv: Read CSV rows (Python 2 style):")
for row in reader:
print(row)
# Expected output in a Python 2 environment would be lists of unicode strings.
Debug
Known issues
breakingunicodecsv is fundamentally incompatible with Python 3's `csv` module. Python 3's `csv` module expects text streams, not byte streams, and handles unicode automatically. Using `unicodecsv` in Python 3 will lead to `TypeError` or incorrect encoding behavior.fixFor Python 3, use the standard library's `csv` module directly. It natively supports Unicode and is the correct approach for modern Python applications.
affects: All versions of unicodecsv when used with Python 3.
deprecatedThis library is effectively abandoned and unmaintained since its last release in 2016. Its primary purpose was to address Unicode issues in Python 2's standard `csv` module. Python 3's `csv` module resolved these issues natively, making this library obsolete for modern Python development.fixMigrate to Python 3 and use the built-in `csv` module for Unicode CSV handling.
affects: All versions
gotchaunicodecsv is designed *exclusively* for Python 2. Attempting to use it in a Python 3 environment is incorrect and will introduce unnecessary complexity and potential encoding errors. It adds no value in Python 3.fixDo not install or use `unicodecsv` in Python 3 projects. Rely on the standard `csv` library instead.
affects: All versions when used with Python 3
gotchaWhen using `unicodecsv` in Python 2, ensure files are opened in binary mode (e.g., `open('filename', 'wb')` or `open('filename', 'rb')`). The library expects byte streams for its internal encoding/decoding mechanism.fixAlways use binary mode (`'wb'`, `'rb'`) when opening files for `unicodecsv.writer` or `unicodecsv.reader` in Python 2.
affects: All versions when used with Python 2
Upgrade
Version history
0.14.1latest on PyPI · released Sep 22, 2015
Audit
Dependencies
No dependency data recorded yet.