diff options
Diffstat (limited to 'Lib/plat-riscos/riscospath.py')
-rw-r--r-- | Lib/plat-riscos/riscospath.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/plat-riscos/riscospath.py b/Lib/plat-riscos/riscospath.py index b83c632fc1..a38b22c62a 100644 --- a/Lib/plat-riscos/riscospath.py +++ b/Lib/plat-riscos/riscospath.py @@ -203,21 +203,30 @@ def exists(p): """ Test whether a path exists. """ - return swi.swi('OS_File', '5s;i', p)!=0 + try: + return swi.swi('OS_File', '5s;i', p)!=0 + except swi.error: + return 0 def isdir(p): """ Is a path a directory? Includes image files. """ - return swi.swi('OS_File', '5s;i', p) in [2, 3] + try: + return swi.swi('OS_File', '5s;i', p) in [2, 3] + except swi.error: + return 0 def isfile(p): """ Test whether a path is a file, including image files. """ - return swi.swi('OS_File', '5s;i', p) in [1, 3] + try: + return swi.swi('OS_File', '5s;i', p) in [1, 3] + except swi.error: + return 0 def islink(p): |