binance_data
binance_data copied to clipboard
Issue with multiprocessing.managers
Thanks a bunch for the great script.
Not so proficient in how python multiprocessing
module works. But I get the following error once all individual csvs are downloaded and the code is about to run
data = pool.starmap(self.kline_to_csv,zip(pair,re(start_date),re(end_date),re(kline_interval_directory),re(interval),re(csv_file_info)))
I get the following error:
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/managers.py", line 811, in _callmethod
conn = self._tls.connection
AttributeError: 'ForkAwareLocal' object has no attribute 'connection'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 47, in starmapstar
return list(itertools.starmap(args[0], args[1]))
File "/Users/masza/PycharmProjects/data-hoarding/venv/lib/python3.7/site-packages/binance_data/client.py", line 342, in kline_to_csv
csv_file_info.append(file_retrevial_info)
File "<string>", line 2, in append
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/managers.py", line 815, in _callmethod
self._connect()
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/managers.py", line 802, in _connect
conn = self._Client(self._token.address, authkey=self._authkey)
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/connection.py", line 492, in Client
c = SocketClient(address)
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/connection.py", line 619, in SocketClient
s.connect(address)
ConnectionRefusedError: [Errno 61] Connection refused
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/masza/PycharmProjects/data-hoarding/venv/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-4-bdb8858db215>", line 1, in <module>
store_data = DataClient().kline_data(pair_list,'1m',start_date='01/01/2020',end_date='05/21/2020',storage=['csv','/Users/masza/PycharmProjects/data-hoarding'],progress_statements=True)
File "/Users/masza/PycharmProjects/data-hoarding/venv/lib/python3.7/site-packages/binance_data/client.py", line 376, in kline_data
data = pool.starmap(self.kline_to_csv,zip(pair,re(start_date),re(end_date),re(kline_interval_directory),re(interval),re(csv_file_info)))
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 276, in starmap
return self._map_async(func, iterable, starmapstar, chunksize).get()
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 657, in get
raise self._value
ConnectionRefusedError: [Errno 61] Connection refused
Any thoughts? python version: Python 3.7.5
Hello @altertype, @uneasyguy might be busy. This is a Windows issue, not much to do with his code. I have used this library umpteen times on MacBook and it didn't fail to deliver. Please, if you don't have a MacBook, a better workaround is to find a Free Linux machine online like Google Cloud FREE $300 credit. Setup Python on it, install this library, and it'll work as expected.
I hope this helps.