Closed kimoldfield closed 5 years ago
The warning can be removed with the following patch:
--- ciscoconfparse.py.old 2018-11-07 18:36:39.599368903 +1100
+++ ciscoconfparse.py 2018-11-07 18:23:25.680051450 +1100
@@ -62,8 +62,9 @@
"""
## Docstring props: http://stackoverflow.com/a/1523456/667301
-__version__ = open(os.path.join(os.path.dirname(os.path.abspath(__file__)),
- 'version')).read().strip()
+with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'version')) \
+ as fh:
+ __version__ = fh.read().strip()
__email__ = "mike /at\ pennington [dot] net"
__author__ = "David Michael Pennington <{0}>".format(__email__)
__copyright__ = "2007-{0}, {1}".format(time.strftime('%Y'), __author__)
This should be fixed in version 1.3.22
This isn't fixed, or it's a regression in version 1.3.39.
/home/vagrant/.venv/lib/python3.6/site-packages/ciscoconfparse/ciscoconfparse.py:77: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/vagrant/.venv/lib/python3.6/site-packages/ciscoconfparse/version' mode='r' encoding='UTF-8'>
__version__ = open(versionfilepath).read().strip()
@jobec version 1.3.40 should help
Using ciscoconfparse under python 3.4 with unittest gets the warning: