Permalink
Browse files

[#690] handle exception raised by os.path.relpath with paths on diffe…

…rent drives in Windows
  • Loading branch information...
ryenus authored and mbknor committed Oct 26, 2011
1 parent 5681967 commit fee15a80b79fe2859146d15a8f519523d60b1c04
Showing with 9 additions and 6 deletions.
  1. +9 −6 framework/pym/play/utils.py
@@ -35,12 +35,15 @@ def secretKey():
return ''.join([random.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') for i in range(64)])
def isParentOf(path1, path2):
- relpath = os.path.relpath(path1, path2)
- sep = os.sep
- if sep == '\\':
- sep = '\\\\'
- ptn = '^\.\.(' + sep + '\.\.)*$'
- return re.match(ptn, relpath) != None
+ try:
+ relpath = os.path.relpath(path1, path2)
+ sep = os.sep
+ if sep == '\\':
+ sep = '\\\\'
+ ptn = '^\.\.(' + sep + '\.\.)*$'
+ return re.match(ptn, relpath) != None
+ except:
+ return False
def getWithModules(args, env):
withModules = []

0 comments on commit fee15a8

Please sign in to comment.