jldbc / pybaseball

Pull current and historical baseball statistics using Python (Statcast, Baseball Reference, FanGraphs)
MIT License
1.19k stars 324 forks source link

statcast() does not work when the parameter parallel=True (default). statcast() does not work but statcast(parallel=False) works but is very slow #287

Closed roman-smith closed 1 year ago

roman-smith commented 1 year ago

Leaving parallel=True results in the following error: concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.

tjburch commented 1 year ago

This issue often comes up when multiprocessing on Windows environments - it's thrown to avoid recursive subprocess spawning. Are you on Windows? If so, the solution is to just wrap the call in a function, simplest (least clean) is to just put

if __name__ == '__main__':
     main()

at the bottom and wrap the whole thing in def main():.

roman-smith commented 1 year ago

That worked, thank you