130 # with SEM_FAILCRITICALERRORS (1) prevents this popup. |
130 # with SEM_FAILCRITICALERRORS (1) prevents this popup. |
131 # |
131 # |
132 oldMode = ctypes.windll.kernel32.SetErrorMode(1) |
132 oldMode = ctypes.windll.kernel32.SetErrorMode(1) |
133 try: |
133 try: |
134 for disk in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ': |
134 for disk in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ': |
135 path = '{}:\\'.format(disk) |
135 path = '{0}:\\'.format(disk) |
136 if (os.path.exists(path) and |
136 if (os.path.exists(path) and |
137 getVolumeName(path) == 'CIRCUITPY'): |
137 getVolumeName(path) == 'CIRCUITPY'): |
138 return path |
138 return path |
139 finally: |
139 finally: |
140 ctypes.windll.kernel32.SetErrorMode(oldMode) |
140 ctypes.windll.kernel32.SetErrorMode(oldMode) |