##// END OF EJS Templates
issue is with 'with'statetment
kd2718 -
Show More
@@ -212,25 +212,27 b' class OSMagics(Magics):'
212 # write the whole loop for posix/Windows so we don't have an if in
212 # write the whole loop for posix/Windows so we don't have an if in
213 # the innermost part
213 # the innermost part
214 if self.is_posix:
214 if self.is_posix:
215 print(path)
215 for pdir in path:
216 for pdir in path:
216 try:
217 try:
217 os.chdir(pdir)
218 os.chdir(pdir)
218 except OSError:
219 except OSError:
219 continue
220 continue
220 with os.scandir(pdir) as dirlist:
221 dirlist = os.scandir(path=pdir)
221 for ff in dirlist:
222 #with os.scandir(pdir) as dirlist:
222 if self.isexec(ff):
223 for ff in dirlist:
223 fname = ff.name
224 if self.isexec(ff):
224 try:
225 fname = ff.name
225 # Removes dots from the name since ipython
226 try:
226 # will assume names with dots to be python.
227 # Removes dots from the name since ipython
227 if not self.shell.alias_manager.is_alias(fname):
228 # will assume names with dots to be python.
228 self.shell.alias_manager.define_alias(
229 if not self.shell.alias_manager.is_alias(fname):
229 fname.replace('.',''), fname)
230 self.shell.alias_manager.define_alias(
230 except InvalidAliasError:
231 fname.replace('.',''), fname)
231 pass
232 except InvalidAliasError:
232 else:
233 pass
233 syscmdlist.append(fname)
234 else:
235 syscmdlist.append(fname)
234 else:
236 else:
235 no_alias = Alias.blacklist
237 no_alias = Alias.blacklist
236 for pdir in path:
238 for pdir in path:
General Comments 0
You need to be logged in to leave comments. Login now