-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[Bug] NoneType error when trying to import obb from OpenBB #6942
Comments
I found a work around for now. For some reason, it seems like the extension loader pkg is loading en variables & including None in the list of paths passed to importlib. I added a line to take out the ones that wont work in importlib |
Hmm.. I'm not able to reproduce. What versions do you have installed? Sonoma 14.6.1 conda 24.9.1
importlib_metadata 8.5.0
openbb 4.3.4
pip 24.3.1 |
What are the exact steps in recreating your complete environment? |
@Chidifinance from the error log I assume that it starts failing when importing your user settings. Can you look into the ~/.openbb_platform folder and show the contents of your user_settings.json? You will need to remove the credentials before sharing |
Also an output of |
Describe the bug
It's as description says, when I try to import obb from openbb I get
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
To Reproduce
Only one step
from openbb import obb
Screenshots
Desktop (please complete the following information):
Additional context
Full Error output:
{
"name": "TypeError",
"message": "stat: path should be string, bytes, os.PathLike or integer, not NoneType",
"stack": "---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[8], line 1
----> 1 from openbb import obb
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/openbb/init.py:8
5 from pathlib import Path
6 from typing import List, Optional, Union
----> 8 from openbb_core.app.static.app_factory import (
9 BaseApp as _BaseApp,
10 create_app as _create_app,
11 )
12 from openbb_core.app.static.package_builder import PackageBuilder as _PackageBuilder
13 from openbb_core.app.static.reference_loader import ReferenceLoader as _ReferenceLoader
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/openbb_core/app/static/app_factory.py:7
5 from openbb_core.app.command_runner import CommandRunner
6 from openbb_core.app.model.system_settings import SystemSettings
----> 7 from openbb_core.app.model.user_settings import UserSettings
8 from openbb_core.app.static.account import Account
9 from openbb_core.app.static.container import Container
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/openbb_core/app/model/user_settings.py:6
3 from pydantic import Field
5 from openbb_core.app.model.abstract.tagged import Tagged
----> 6 from openbb_core.app.model.credentials import Credentials
7 from openbb_core.app.model.defaults import Defaults
8 from openbb_core.app.model.preferences import Preferences
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/openbb_core/app/model/credentials.py:98
94 model.origins = self.credentials
95 return model
---> 98 _Credentials = CredentialsLoader().load()
101 class Credentials(_Credentials): # type: ignore
102 """Credentials model used to store provider credentials."""
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/openbb_core/app/model/credentials.py:87, in CredentialsLoader.load(self)
85 """Load credentials from providers."""
86 # We load providers first to give them priority choosing credential names
---> 87 self.from_providers()
88 self.from_obbject()
89 model = create_model(
90 "Credentials",
91 config=ConfigDict(validate_assignment=True, populate_by_name=True),
92 **self.format_credentials(), # type: ignore
93 )
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/openbb_core/app/model/credentials.py:82, in CredentialsLoader.from_providers(self)
80 def from_providers(self) -> None:
81 """Load credentials from providers."""
---> 82 self.credentials = ProviderInterface().credentials
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/openbb_core/app/model/abstract/singleton.py:17, in SingletonMeta.call(cls, *args, **kwargs)
15 """Singleton pattern implementation."""
16 if cls not in cls._instances:
---> 17 instance = super().call(*args, **kwargs)
18 cls._instances[cls] = instance
20 return cls._instances[cls]
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/openbb_core/app/provider_interface.py:107, in ProviderInterface.init(self, registry_map, query_executor)
101 def init(
102 self,
103 registry_map: Optional[RegistryMap] = None,
104 query_executor: Optional[QueryExecutor] = None,
105 ) -> None:
106 """Initialize provider interface."""
--> 107 self._registry_map = registry_map or RegistryMap()
108 self._query_executor = query_executor or QueryExecutor
110 self._map = self._registry_map.standard_extra
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/openbb_core/provider/registry_map.py:26, in RegistryMap.init(self, registry)
24 def init(self, registry: Optional[Registry] = None) -> None:
25 """Initialize Registry Map."""
---> 26 self._registry = registry or RegistryLoader.from_extensions()
27 self._credentials = self._get_credentials(self._registry)
28 self._available_providers = self._get_available_providers(self._registry)
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/openbb_core/provider/registry.py:44, in RegistryLoader.from_extensions()
41 """Load providers from entry points."""
42 registry = Registry()
---> 44 for name, entry in ExtensionLoader().provider_objects.items(): # type: ignore[attr-defined]
45 try:
46 registry.include_provider(provider=entry)
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/openbb_core/app/model/abstract/singleton.py:17, in SingletonMeta.call(cls, *args, **kwargs)
15 """Singleton pattern implementation."""
16 if cls not in cls._instances:
---> 17 instance = super().call(*args, **kwargs)
18 cls._instances[cls] = instance
20 return cls._instances[cls]
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/openbb_core/app/extension_loader.py:41, in ExtensionLoader.init(self)
37 def init(
38 self,
39 ) -> None:
40 """Initialize the extension loader."""
---> 41 self._obbject_entry_points: EntryPoints = self._sorted_entry_points(
42 group=OpenBBGroups.obbject.value
43 )
44 self._core_entry_points: EntryPoints = self._sorted_entry_points(
45 group=OpenBBGroups.core.value
46 )
47 self._provider_entry_points: EntryPoints = self._sorted_entry_points(
48 group=OpenBBGroups.provider.value
49 )
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/openbb_core/app/extension_loader.py:127, in ExtensionLoader._sorted_entry_points(group)
124 @staticmethod
125 def _sorted_entry_points(group: str) -> EntryPoints:
126 """Return a sorted dictionary of entry points."""
--> 127 return sorted(entry_points(group=group))
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/importlib_metadata/init.py:1051, in entry_points(**params)
1040 """Return EntryPoint objects for all installed packages.
1041
1042 Pass selection parameters (group or name) to filter the
(...)
1046 :return: EntryPoints for all installed packages.
1047 """
1048 eps = itertools.chain.from_iterable(
1049 dist.entry_points for dist in _unique(distributions())
1050 )
-> 1051 return EntryPoints(eps).select(**params)
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/importlib_metadata/init.py:1048, in (.0)
1039 def entry_points(**params) -> EntryPoints:
1040 """Return EntryPoint objects for all installed packages.
1041
1042 Pass selection parameters (group or name) to filter the
(...)
1046 :return: EntryPoints for all installed packages.
1047 """
-> 1048 eps = itertools.chain.from_iterable(
1049 dist.entry_points for dist in _unique(distributions())
1050 )
1051 return EntryPoints(eps).select(**params)
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/importlib_metadata/_itertools.py:16, in unique_everseen(iterable, key)
14 yield element
15 else:
---> 16 for element in iterable:
17 k = key(element)
18 if k not in seen:
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/importlib_metadata/init.py:931, in (.0)
928 """Find metadata directories in paths heuristically."""
929 prepared = Prepared(name)
930 return itertools.chain.from_iterable(
--> 931 path.search(prepared) for path in map(FastPath, paths)
932 )
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/importlib_metadata/init.py:790, in FastPath.search(self, name)
789 def search(self, name):
--> 790 return self.lookup(self.mtime).search(name)
File ~/miniconda3/envs/openbb/lib/python3.11/site-packages/importlib_metadata/init.py:795, in FastPath.mtime(self)
792 @Property
793 def mtime(self):
794 with suppress(OSError):
--> 795 return os.stat(self.root).st_mtime
796 self.lookup.cache_clear()
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType"
}
The text was updated successfully, but these errors were encountered: