regebro / tzlocal

A Python module that tries to figure out what your local timezone is
MIT License
184 stars 58 forks source link

Closes stdout and stderr to get rid of ResourceWarnings #36

Closed johnwquarles closed 7 years ago

johnwquarles commented 7 years ago

Hi there,

When running tzlocal on my Mac, I get the following warnings:

/Users/john/.virtualenvs/sams/lib/python3.4/site-packages/tzlocal/darwin.py:29: ResourceWarning: unclosed file <_io.BufferedReader name=4>
  _cache_tz = _get_localzone()
/Users/john/.virtualenvs/sams/lib/python3.4/site-packages/tzlocal/darwin.py:29: ResourceWarning: unclosed file <_io.BufferedReader name=6>
  _cache_tz = _get_localzone()

This PR will get rid of them by closing (in darwin.py) the stderr and stdouts of the subprocess that is created.

Thank you for the useful package!

regebro commented 7 years ago

Thanks.