Commit a184b8a4 authored by eric pellegrini's avatar eric pellegrini

bug fix path_to_module function: the list of directories has to be parsed backwards

parent 2e716547
......@@ -44,11 +44,11 @@ def path_to_module(path,stop=""):
splittedPath = path.split(os.sep)
try:
idx = splittedPath.index(stop)
idx = splittedPath[::-1].index(stop)
except ValueError:
idx = 0
finally:
module = ".".join(splittedPath[idx:])
module = ".".join(splittedPath[len(splittedPath)-1-idx:])
return module
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment