| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -191,8 +191,11 @@ def iter_modules(self, prefix=''): | |||
| 191 | 191 | ||
| 192 | 192 | yielded = {} | |
| 193 | 193 | import inspect | |
| 194 | - | ||
| 195 | - filenames = os.listdir(self.path) | ||
| 194 | + try: | ||
| 195 | + filenames = os.listdir(self.path) | ||
| 196 | + except OSError: | ||
| 197 | + # ignore unreadable directories like import does | ||
| 198 | + filenames = [] | ||
| 196 | 199 | filenames.sort() # handle packages before same-named modules | |
| 197 | 200 | ||
| 198 | 201 | for fn in filenames: | |
@@ -205,7 +208,12 @@ def iter_modules(self, prefix=''): | |||
| 205 | 208 | ||
| 206 | 209 | if not modname and os.path.isdir(path) and '.' not in fn: | |
| 207 | 210 | modname = fn | |
| 208 | - for fn in os.listdir(path): | ||
| 211 | + try: | ||
| 212 | + dircontents = os.listdir(path) | ||
| 213 | + except OSError: | ||
| 214 | + # ignore unreadable directories like import does | ||
| 215 | + dircontents = [] | ||
| 216 | + for fn in dircontents: | ||
| 209 | 217 | subname = inspect.getmodulename(fn) | |
| 210 | 218 | if subname=='__init__': | |
| 211 | 219 | ispkg = True | |
| Back | FazBrowse Home | New Git URL |
0 commit comments