Not all ntpath.py-methods do recognize shares, do they?

Franz GEIGER fgeiger at datec.at
Fri Feb 23 12:46:41 EST 2001


I had to change  exists() and isdir() of ntpath.py so that they work for my
purposes (shares ARE dirs in my apps):

##### DDG\fge (20001122)
#def exists(path):
#    """Test whether a path exists"""
#    try:
#        st = os.stat(path)
#    except os.error:
#        return 0
#    return 1
def exists(path):
    """Test whether a path exists"""
    try:
        st = os.stat(path)
    except os.error:
        if ismount(path):
            return 1
        return 0
    return 1
#
##### DDG\fge (20001122)


##### DDG\fge (20010223)
#def isdir(path):
#    """Test whether a path is a directory"""
#    try:
#        st = os.stat(path)
#    except os.error:
#        return 0
#    return stat.S_ISDIR(st[stat.ST_MODE])
def isdir(path):
    """Test whether a path is a directory"""
    try:
        st = os.stat(path)
    except os.error:
        if ismount(path):
            return 1
        return 0
    return stat.S_ISDIR(st[stat.ST_MODE])
#
##### DDG\fge (20010223)


Any comments? Did I miss something?

Best regards
Franz GEIGER








More information about the Python-list mailing list