Skip to content

BUG: mod_wsgi restricting access to stdout throws unhandled IOError. #21552

Closed
@JayOfferdahl

Description

@JayOfferdahl

Problem description

We're using pandas on the backend of our internal web server for a few utilities. Any attempt to import the library causes an IOError to be thrown due to our setup of mod_wsgi restricting stdout access by default (WSGIRestrictStdout On).

The cause of this error is an attempt to get the client encoding on init when registering options. A call is made to detect_client_encoding() in console.py under pandas/io/formats/ which is throwing the IOError. The call to sys.stdout.encoding in this function is contained inside a try/except block, however, the except statement is limited to an AttributeError.

I propose we expand this except statement to allow for both AttributeErrors and IOErrors.

Details

INSTALLED VERSIONS

commit: e2d5958
python: 2.7.15.final.0
python-bits: 64
OS: Linux
OS-release: 4.16.14-300.fc28.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None

pandas: 0.24.0.dev0+118.ge2d5958bb
pytest: 3.6.1
pip: 9.0.3
setuptools: 39.2.0
Cython: 0.28.3
numpy: 1.14.5
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO DataIO issues that don't fit into a more specific label

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions