summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sphinx/apidoc.py4
-rw-r--r--sphinx/writers/html.py5
2 files changed, 7 insertions, 2 deletions
diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py
index 4a64dd33..346956d3 100644
--- a/sphinx/apidoc.py
+++ b/sphinx/apidoc.py
@@ -21,6 +21,8 @@ import sys
import optparse
from os import path
+from sphinx.util.osutil import walk
+
# automodule options
if 'SPHINX_APIDOC_OPTIONS' in os.environ:
OPTIONS = os.environ['SPHINX_APIDOC_OPTIONS'].split(',')
@@ -185,7 +187,7 @@ def recurse_tree(rootpath, excludes, opts):
toplevels = []
followlinks = getattr(opts, 'followlinks', False)
includeprivate = getattr(opts, 'includeprivate', False)
- for root, subs, files in os.walk(rootpath, followlinks=followlinks):
+ for root, subs, files in walk(rootpath, followlinks=followlinks):
# document only Python module files (that aren't excluded)
py_files = sorted(f for f in files
if path.splitext(f)[1] in PY_SUFFIXES and
diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py
index 765ee905..13dd5d42 100644
--- a/sphinx/writers/html.py
+++ b/sphinx/writers/html.py
@@ -405,7 +405,10 @@ class HTMLTranslator(BaseTranslator):
node['width'] = str(im.size[0])
if 'height' not in node:
node['height'] = str(im.size[1])
- del im
+ try:
+ im.fp.close()
+ except Exception:
+ pass
BaseTranslator.visit_image(self, node)
def visit_toctree(self, node):