I'm using the win32 api to map samba shares, and I'm having trouble handling some exceptions. In my script there are 2 possible exceptions when the script attempts to map a share:
>>> win32net.NetUseAdd(None, 1, {'remote':r'\\foo\bar','local':'X Traceback (most recent call last): File "<stdin>", line 1, in ? pywintypes.error: (53, 'NetUseAdd', 'The network path was not found.') This exception occurs when '\\foo\bar' is not an existing share. Also, when a drive letter is already in use the following occurs: >>> win32net.NetUseAdd(None, 1, {'remote':r'\\some_server\share','local':'Y:'}) Traceback (most recent call last): File "<stdin>", line 1, in ? pywintypes.error: (85, 'NetUseAdd', 'The local device name is already in use.') I know the exception raised in these cases is "pywintypes.error", but how can i differentiate between the two exceptions? Being able to do this is critical for my script.... Thanks in advance, --Lucas Machado -- http://mail.python.org/mailman/listinfo/python-list