Passing kite variable to function using multiprocessing

trader007
I am trying to use multiprocessing and passing kite connection variable and getting the below error

PicklingError: Can't pickle : attribute lookup __builtin__.module failed

Can someone please help
  • trader007
    @sujith can someone please reply
  • sujith
    Hi @trader007,
    Can you paste your code?
  • trader007
    trader007 edited June 2017


    def initialize_kite():
    api_key=""
    request_token=""
    secret=""

    global kite

    global user
    kite = KiteConnect(api_key)

    if not os.path.exists(file_name):
    try:
    user = kite.request_access_token(request_token,secret)

    kite.set_access_token(user["access_token"])

    except Exception as e:

    raise




    print user["user_id"], "has logged in"
    print user["access_token"]
    #
    return kite


    if __name__ == "__main__":
    kite_handle=initialize_kite()
    x=Parallel(n_jobs=num_cores)(delayed(process)(i,stocks_list,kite_handle) for i in inputs)


    @sujith Code works fine if i dont pass kite_handle in the last line
  • trader007
    @sujith any luck here?
Sign In or Register to comment.