Skip to content

Message about unclosed files in affiliated packages - #3156

Merged
astrofrog merged 1 commit into
astropy:masterfrom
embray:issue-3156
Nov 29, 2014
Merged

astrofrog merged 1 commit into
astropy:masterfrom
embray:issue-3156

Conversation

@embray

@embray embray commented Nov 28, 2014

Copy link
Copy Markdown
Member

For a number of affiliated packages, I see the following when running python setup.py test with Python 3.4:

sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='/Volumes/Raptor/Library/Python/3.4/lib/python/site-packages/astropy-1.0.dev10555-py3.4-macosx-10.8-x86_64.egg/astropy/extern/bundled/six.py' mode='r' encoding='utf-8'>

This occurs after the tests have run. @cdeil also reported a similar issue in the past.

To reproduce:

git clone [email protected]:astrofrog/wcsaxes.git
cd wcsaxes
python setup.py test  # with Python 3.4

Output:

...
=============== 4 failed, 113 passed, 1 skipped in 8.23 seconds ================
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='/Volumes/Raptor/Library/Python/3.4/lib/python/site-packages/astropy-1.0.dev10555-py3.4-macosx-10.8-x86_64.egg/astropy/extern/bundled/six.py' mode='r' encoding='utf-8'>
/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_bootstrap.py:2150: ImportWarning: sys.meta_path is empty
sys:1: ResourceWarning: unclosed file <_io.BufferedReader name=10>
sys:1: ResourceWarning: unclosed file <_io.BufferedReader name=12>

I'm opening this here because I wonder if it's to do with the way we import the six module?

…it uses (namely mod_info, which includes an open filehandle) go out of scope when they're no longer needed. Fixes astropy#3156.
@embray

embray commented Nov 28, 2014

Copy link
Copy Markdown
Member

Fix attached--thanks. I don't think there's really any straightforward way to add a regression test for this. I have some ideas but it's probably not worth the effort.

@embray embray added this to the v0.4.3 milestone Nov 28, 2014
@embray

embray commented Nov 28, 2014

Copy link
Copy Markdown
Member

@astrofrog Go ahead and try it out before I merge, but this did seem to do the trick for me.

@astrofrog

Copy link
Copy Markdown
Member Author

@embray - works for me, thanks!

astrofrog added a commit that referenced this pull request Nov 29, 2014
Message about unclosed files in affiliated packages
@astrofrog
astrofrog merged commit 2e69f31 into astropy:master Nov 29, 2014
@embray
embray deleted the issue-3156 branch December 1, 2014 17:25
astrofrog added a commit that referenced this pull request Dec 31, 2014
Message about unclosed files in affiliated packages
Conflicts:
	CHANGES.rst
QuLogic added a commit to QuLogic/vispy that referenced this pull request Jun 2, 2015
This should prevent unnecessary variables from polluting the six
namespace. It also fixes a resource warning as described in
astropy/astropy#3156.
QuLogic added a commit to QuLogic/vispy that referenced this pull request Jun 2, 2015
This should prevent unnecessary variables from polluting the six
namespace. It also fixes a resource warning as described in
astropy/astropy#3156.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants