Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd_test.py执行时astock.py中getStockDailyPrice()多线程调用时出错 #1

Open
ngg1285 opened this issue Apr 21, 2023 · 1 comment

Comments

@ngg1285
Copy link

ngg1285 commented Apr 21, 2023

cmd_test.py执行时x=market.get_price("000044.SZ",'20180102')获取不到值,但是df=AStock.getStockDailyPriceByCode('000043.SZ',fq='no')可以获取到值。
运行过程中,会发生错误,在astock.py
在以下行出现多线程的错误
mytask=pool.submit(AStock.getStockDailyPriceByCode,code=code,where=where,startdate=startdate,enddate=enddate,fq=fq)

Exception has occurred: RuntimeError (note: full exception trace is shown but execution is paused at: )

    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.

File "D:\finhack\library\astock.py", line 130, in getStockDailyPrice
mytask=pool.submit(AStock.getStockDailyPriceByCode,code=code,where=where,startdate=startdate,enddate=enddate,fq=fq)
File "D:\finhack\library\market.py", line 52, in load_price
df_price=AStock.getStockDailyPrice(fq='no')
File "D:\finhack\command\cmd_test.py", line 26, in
df_price=market.load_price()
File "", line 1, in (Current frame)
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.
@woldy
Copy link
Contributor

woldy commented May 9, 2023

代码是在linux平台上开发的,windows平台还没经过严格测试,后面等有时间了修复下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants