binance_data icon indicating copy to clipboard operation
binance_data copied to clipboard

Runtime Error running the example in multiprocessing

Open shep-analytics opened this issue 4 years ago • 1 comments

So When I run the basic example:

from binance_data.client import DataClient

pair_list = DataClient().get_binance_pairs(quote_currencies=['ETH'])
print(pair_list)


store_data = DataClient().kline_data(pair_list,'1m',start_date='10/09/2020',
									end_date='04/09/2021',storage=['csv',''],
									progress_statements=True)

I'm getting this error with the multiprocessing. I'm not sure if the syntax needs to be changed in the package?

   raise RuntimeError('''
RuntimeError: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
Traceback (most recent call last):
  File "/Users/teancum/binance/git_import.py", line 7, in <module>
    store_data = DataClient().kline_data(pair_list,'1m',start_date='10/09/2020',
  File "/usr/local/lib/python3.9/site-packages/binance_data/client.py", line 386, in kline_data
    csv_file_info = mp.Manager().list()
  File "/usr/local/Cellar/[email protected]/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 57, in Manager
    m.start()
  File "/usr/local/Cellar/[email protected]/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/managers.py", line 557, in start
    self._address = reader.recv()
  File "/usr/local/Cellar/[email protected]/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/connection.py", line 255, in recv
    buf = self._recv_bytes()
  File "/usr/local/Cellar/[email protected]/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/connection.py", line 419, in _recv_bytes
    buf = self._recv(4)
  File "/usr/local/Cellar/[email protected]/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/connection.py", line 388, in _recv
    raise EOFError
EOFError

Thank you

shep-analytics avatar Apr 09 '21 19:04 shep-analytics

Try this

if __name__ == '__main__':
  from binance_data.client import DataClient
  
  pair_list = DataClient().get_binance_pairs(quote_currencies=['ETH'])
  print(pair_list)
  
  
  store_data = DataClient().kline_data(pair_list,'1m',start_date='10/09/2020',
									  end_date='04/09/2021',storage=['csv',''],
									  progress_statements=True)

jaycho1214 avatar Apr 25 '21 19:04 jaycho1214