-
Notifications
You must be signed in to change notification settings - Fork 19
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
AttributeError: 'NoneType' object has no attribute 'f_locals' #9
Comments
Hey Im not the author of this script but Ive been working on my own stock
market program for a few months now and I came across this guys project a
few weeks ago and decided to follow it. I just checked the first two of
those cik numbers and the first one is for blackrock bonds and trust. Bond
and trust companies do not file 10qs or 10ks which is what the companyfacts
endpoint is for. The second cik belongs to direct communications solutions.
Looks like they withdrew from public offering back in oct 2023. They may
not have any entries in companyfacts because they were delisted. I havent
check the other ciks that you got errors for but im sure there are probably
similar reasons. Do some research and let me know.
…On Sat, Nov 2, 2024 at 06:17 hoanghn418 ***@***.***> wrote:
I get a error when test function download_company_concepts.
Snipcode:
from datamule import Downloader
downloader = Downloader()
downloader.download_company_concepts()
Error logs:
Failed to download: 404, message='Not Found', url='https://data.sec.gov/api/xbrl/companyfacts/CIK0001169034.json'
Downloading files: 79%|█████████████████████████████████████████████████████▉ | 8072/10167 [1:02:09<03:40, 9.50it/s]
Failed to download: 404, message='Not Found', url='https://data.sec.gov/api/xbrl/companyfacts/CIK0001779303.json'
Downloading files: 79%|██████████████████████████████████████████████████████ | 8082/10167 [1:02:10<03:04, 11.27it/s]
Failed to download: 404, message='Not Found', url='https://data.sec.gov/api/xbrl/companyfacts/CIK0001227862.json'
Downloading files: 80%|██████████████████████████████████████████████████████ | 8086/10167 [1:02:10<03:45, 9.25it/s]Error downloading https://data.sec.gov/api/xbrl/companyfacts/CIK0001278752.json: https://data.sec.gov/api/xbrl/companyfacts/CIK0001278752.json
Rate limited for https://data.sec.gov/api/xbrl/companyfacts/CIK0001278752.json. Will retry after 601 seconds.
Rate limit hit. Sleeping for 601 seconds before retrying.
Downloading files: 80%|██████████████████████████████████████████████████████ | 8086/10167 [1:46:00<27:17, 1.27it/s]
Traceback (most recent call last):
File "/datamule-python/datamule/../examples/download_company_concepts_for_all_companies.py", line 5, in <module>
downloader.download_company_concepts()
File "/datamule-python/.venv/lib/python3.12/site-packages/datamule-0.376-py3.12.egg/datamule/downloader/sec_downloader.py", line 493, in download_company_concepts
self.run_download_urls(urls=urls, filenames=filenames, output_dir=output_dir)
File "/datamule-python/.venv/lib/python3.12/site-packages/datamule-0.376-py3.12.egg/datamule/downloader/sec_downloader.py", line 198, in run_download_urls
return asyncio.run(self._download_urls(urls, filenames, output_dir))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ***@***.***/3.12.5/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File ***@***.***/3.12.5/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ***@***.***/3.12.5/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/datamule-python/.venv/lib/python3.12/site-packages/datamule-0.376-py3.12.egg/datamule/downloader/sec_downloader.py", line 188, in _download_urls
urls = [task.get_coro().cr_frame.f_locals['url'] for task in pending]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'f_locals'
—
Reply to this email directly, view it on GitHub
<#9>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AI3AHY52JHO5RNHYNAMBPTDZ6SYELAVCNFSM6AAAAABRBUMRJCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGYZTAMZZGU2DQNY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hi @340cruz, very helpful. The @hoanghn418 The error stopping your code from running is that the rate limit was triggered, and the downloader failed to handle it correctly. This may be because you opened a sec.gov url in your browser which pushed the requests/second over the maximum, and then the downloader incorrectly handled the rate limit error. Workaround:
I'll look into updating the downloader to be more robust with rate-limits. Note: I'm working on something that will allow me to move away from downloading using the SEC as rate limits + lack of metadata is currently the most requested feature. |
I get a error when test function
download_company_concepts
.Snipcode:
Error logs:
How about includes a check to ensure
task.get_coro().cr_frame is not None
before accessingf_locals
?The text was updated successfully, but these errors were encountered: