-
Notifications
You must be signed in to change notification settings - Fork 0
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
ImportError: cannot import name 'config' from 'settings' #2
Comments
I resolved this issue by modifying import os
import logging
import yaml
from dotenv import load_dotenv
from datetime import datetime
logger = logging.getLogger(__name__)
load_dotenv()
BLUESKY_USERNAME = os.getenv("BLUESKY_USERNAME")
BLUESKY_PASSWORD = os.getenv("BLUESKY_PASSWORD")
RSS_FEED_URL = os.getenv("RSS_FEED_URL")
# Minimum date for RSS entries to be posted (default to November 13, 2024)
MIN_POST_DATE = os.getenv("MIN_POST_DATE", "2024-11-13")
MIN_POST_DATE = datetime.strptime(MIN_POST_DATE, "%Y-%m-%d")
def load_config():
"""Load configuration from YAML file."""
try:
config_path = os.path.join(os.path.dirname(__file__), '../config.yaml')
with open(config_path, 'r') as f:
return yaml.safe_load(f)
except Exception as e:
logger.critical(f"Failed to load config file: {e}")
raise
config = load_config() |
The For example, here is the URI for the Slashdot front-page RSS feed: https://rss.slashdot.org/Slashdot/slashdotMain. |
I am doing what you said, I am selecting the site you sent as feed, but it
still gives an error
…On Thu, Jan 9, 2025 at 7:42 AM Pile Of Garbage ***@***.***> wrote:
The RSS_FEED_URL setting in your .env
<https://github.com/MisterClean/ChicagoYIMBYblueskybot?tab=readme-ov-file#3-set-up-environment-variables>
must be set to a well-formed URI pointing to a valid RSS feed file. This
file should be in XML and conform to a spec supported by feedparser
<https://feedparser.readthedocs.io/en/latest/introduction.html#introduction>
(Ideally RSS 2.0 <https://www.rssboard.org/rss-specification>).
For example, here is the URI for the Slashdot <https://slashdot.org/>
front-page RSS feed: https://rss.slashdot.org/Slashdot/slashdotMain.
—
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6MQOFTYQC5KWVBFGJGPJKT2JX44LAVCNFSM6AAAAABT6THR5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZZGE3DSNZRGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I encountered the following error while trying to run the project:
Traceback (most recent call last):
File "C:\Users***ChicagoYIMBYblueskybot\src\main.py", line 3, in
from bot.bot_logic import BotLogic
File "C:\Users***ChicagoYIMBYblueskybot\src\bot\bot_logic.py", line 6, in
from bot.post_handler import PostHandler
File "C:\Users***ChicagoYIMBYblueskybot\src\bot\post_handler.py", line 3, in
from utils.rss_parser import fetch_image_url
File "C:\Users***ChicagoYIMBYblueskybot\src\utils\rss_parser.py", line 10, in
from settings import config
ImportError: cannot import name 'config' from 'settings' (C:\Users***ChicagoYIMBYblueskybot\src\settings.py)
The text was updated successfully, but these errors were encountered: