☰
Login
Signup
Home
›
Python client
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
13.8K
All Categories
0
Incidents
153
Node JS client
40
Go client
793
.Net API client
378
Kite Publisher
537
.Net / VBA / Excel (3rd party)
457
Algorithms and Strategies
993
Java client
1.1K
API clients
403
PHP client
4K
Python client
346
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.3K
General
In this Discussion
June 2017
sujith
June 2017
trader007
Passing kite variable to function using multiprocessing
trader007
June 2017
in
Python client
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
June 2017
@sujith
can someone please reply
sujith
June 2017
Hi
@trader007
,
Can you paste your code?
trader007
June 2017
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
June 2017
@sujith
any luck here?
Sign In
or
Register
to comment.
Can you paste your code?
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