#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    'NoneType' object is not callable


    'NoneType' object is not callable when I run the following code


    def privilege(min_clearance):
    if NAKED not in argv:
    def wrapper(argfunc):
    def clearancecheck(tag, *args):
    if tag.clearance < min_clearance:
    global log_file
    if log_file != None :
    log_file.write(stack().pop()+ " with clearance " + str(tag.clearance) + "called" + \
    argfunc.__name__ + "with min clearance" + \
    str(min_clearance )+ '\n')
    raise SecurityBreach(min_clearance, tag.clearance)
    else:
    return argfunc
    else:
    def wrapper(argfunc):
    return argfunc
    return wrapper

    Thank you for your help.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,900
    Rep Power
    481
    Do you intend this program?
    Code:
    def privilege(min_clearance):
        if NAKED not in argv:
            def wrapper(argfunc):
                def clearancecheck(tag, *args):
                    if tag.clearance < min_clearance:
                        global log_file
                        if log_file:
                            log_file.write(
                                stack().pop()+" with clearance "
                                + str(tag.clearance) + "called"
                                + argfunc.__name__ + "with min clearance"
                                + str(min_clearance )+ '\n')
                        raise SecurityBreach(min_clearance,tag.clearance)
                    else:
                        return argfunc
        else:
            def wrapper(argfunc):
                 return argfunc
        return wrapper
    What is argfunc ?
    What is the purpose of clearancecheck ? It is difficult to access.
    What is NAKED ?
    What is the context?
    What is the command line?
    What is argv ?
    What version of python do you use?

    Yes, this interactive python console snippet raises an exception:
    >>> None()
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo