edgarminers / python-edgar

Download the SEC filings index from EDGAR since 1993

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RuntimeError for windows

kasperj93 opened this issue · comments

RuntimeError occurs when runnining the edgar.download_index(dir, year)

This seems to be an error due to the threading on windows. See explanation here: https://pytorch.org/docs/stable/notes/windows.html#multiprocessing-error-without-if-clause-protection

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.

I am not on windows but I will gladly take a pull request!

@kasperj93 what's your python version?

python 3.6, I met the same problem.

Put your code into:
if __name__ == "__main__":

That solved it for me. It has to do with the multiprocessing library used underneath.

Thanks!
I am adding a 'Common issues' section to the README and this is the first item. https://github.com/edouardswiac/python-edgar#common-issues