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

[Bug] Settings/tbnews - Enabling the feature flag breaks the terminal. Crashes on restart. #4385

Closed
deeleeramone opened this issue Mar 2, 2023 · 5 comments · Fixed by #4431 or #4603
Assignees
Labels
bug Fix bug

Comments

@deeleeramone
Copy link
Contributor

image

Screenshot 2023-03-02 at 10 33 24 AM

@deeleeramone deeleeramone added the bug Fix bug label Mar 2, 2023
@jmaslek
Copy link
Collaborator

jmaslek commented Mar 6, 2023

did this get fixed with the user model pr ?

@deeleeramone
Copy link
Contributor Author

mmmm...don't think so. I just enabled in the /settings menu, and used the reset command.


Exception in thread Thread-3312 (run):
Traceback (most recent call last):
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/site-packages/pywry/core.py", line 245, in run
    asyncio.run(self.connect())
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/site-packages/pywry/core.py", line 193, in connect
    async with connect(
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/site-packages/websockets/legacy/client.py", line 642, in __aenter__
    return await self
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/site-packages/websockets/legacy/client.py", line 659, in __await_impl_timeout__
    return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
    return fut.result()
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/site-packages/websockets/legacy/client.py", line 663, in __await_impl__
    _transport, _protocol = await self._create_connection()
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/asyncio/base_events.py", line 1028, in create_connection
    infos = await self._ensure_resolved(
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/asyncio/base_events.py", line 1407, in _ensure_resolved
    return await loop.getaddrinfo(host, port, family=family, type=type,
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/asyncio/base_events.py", line 863, in getaddrinfo
    return await self.run_in_executor(
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/asyncio/base_events.py", line 821, in run_in_executor
    executor.submit(func, *args), loop=self)
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/concurrent/futures/thread.py", line 169, in submit
    raise RuntimeError('cannot schedule new futures after '
RuntimeError: cannot schedule new futures after interpreter shutdown

Then, trying to launch : python terminal.py

(obb) Danglewoods-MacBook-Pro:OpenBBTerminal danglewood$ python terminal.py
Traceback (most recent call last):
  File "/Users/danglewood/GitHub/OpenBBTerminal/terminal.py", line 7, in <module>
    from openbb_terminal.terminal_helper import is_auth_enabled
  File "/Users/danglewood/GitHub/OpenBBTerminal/openbb_terminal/terminal_helper.py", line 19, in <module>
    from openbb_terminal import (
  File "/Users/danglewood/GitHub/OpenBBTerminal/openbb_terminal/thought_of_the_day.py", line 10, in <module>
    from openbb_terminal.helper_funcs import request
  File "/Users/danglewood/GitHub/OpenBBTerminal/openbb_terminal/helper_funcs.py", line 68, in <module>
    twitter_api.get_user(screen_name="openbb_finance")
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/site-packages/tweepy/api.py", line 46, in wrapper
    return method(*args, **kwargs)
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/site-packages/tweepy/api.py", line 2508, in get_user
    return self.request(
  File "/Users/danglewood/GitHub/Conda_M1/miniconda3/envs/obb/lib/python3.10/site-packages/tweepy/api.py", line 265, in request
    raise Forbidden(resp)
tweepy.errors.Forbidden: 403 Forbidden
453 - You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve

@deeleeramone
Copy link
Contributor Author

Reopening because this was not resolved.

in: openbb_terminal/helper_funcs

Add to import block:

from openbb_terminal.core.session.current_user import set_preference

Update the block at line 70:

except tweepy.errors.Unauthorized:
# Set toolbar tweet news to False because the Twitter API is not set up correctly
get_current_user().preferences.TOOLBAR_TWEET_NEWS = False

replacing get_current_user() with:

set_preference("TOOLBAR_TWEET_NEWS", False)

The exception error that is causing this is: Forbidden, instead of Unauthorized

@deeleeramone deeleeramone reopened this Mar 20, 2023
@deeleeramone
Copy link
Contributor Author

@jmaslek - this is still present in 3.0rc1

@montezdesousa montezdesousa self-assigned this Mar 28, 2023
@montezdesousa
Copy link
Contributor

@deeleeramone can you test #4603 and check if it solves your issue pls?

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

Successfully merging a pull request may close this issue.

3 participants