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

I get a module not found error when attempting to run the example in the docs #28

Open
yfprime opened this issue May 29, 2024 · 0 comments

Comments

@yfprime
Copy link

yfprime commented May 29, 2024

I get this error:
Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/media/yfprime/763D304F18FA13FA/tbot1/venv/lib/python3.10/site-packages/main.py", line 106, in <module> stock_industry_category_cninfo_df = stock_industry_category_cninfo( File "/media/yfprime/763D304F18FA13FA/tbot1/venv/lib/python3.10/site-packages/main.py", line 59, in stock_industry_category_cninfo js_content = _get_file_content_ths("cninfo.js") File "/media/yfprime/763D304F18FA13FA/tbot1/venv/lib/python3.10/site-packages/main.py", line 30, in _get_file_content_ths setting_file_path = get_ths_js(file) File "/media/yfprime/763D304F18FA13FA/tbot1/venv/lib/python3.10/site-packages/main.py", line 17, in get_ths_js with resources.path(package="py_mini_racer.data", resource=file) as f: File "/usr/lib/python3.10/importlib/resources.py", line 119, in path reader = _common.get_resource_reader(_common.get_package(package)) File "/usr/lib/python3.10/importlib/_common.py", line 66, in get_package resolved = resolve(package) File "/usr/lib/python3.10/importlib/_common.py", line 57, in resolve return cand if isinstance(cand, types.ModuleType) else importlib.import_module(cand) File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked ModuleNotFoundError: No module named 'py_mini_racer.data'

I am using Python 3.10 and a relative import path.

Here is my code:

from .FinNLP.finnlp.data_sources.news.finnhub_date_range import Finnhub_Date_Range

start_date = "2024-04-01"
end_date = "2024-04-03"
config = {
#"use_proxy": "us_free", # use proxies to prvent ip blocking
"max_retry": 5,
"proxy_pages": 5,
"token": "TOKEN_HERE" # Available at https://finnhub.io/dashboard
}

news_downloader = Finnhub_Date_Range(config) # init
news_downloader.download_date_range_stock(start_date,end_date) # Download headers
news_downloader.gather_content() # Download contents
df = news_downloader.dataframe
df.head(10)
selected_columns = ["headline", "content"]
df[selected_columns].head(10)

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

1 participant