import requests import xml.etree.ElementTree as ET import pandas as pd from PIL import…
- User
import requests import xml.etree.ElementTree as ET import pandas as pd from PIL import Image, ImageDraw, ImageFont, UnidentifiedImageError from io import BytesIO import re import textwrap import zipfile import os import streamlit as st
Kullanıcıdan gerekli bilgileri alma
st.title("RSS Haber Fotoğrafı Üretici") rss_url = st.text_input("RSS adresini girin:") news_count = st.number_input("Çekmek istediğiniz haber sayısını girin:", min_value=1, step=1)
Kullanıcıdan font ayarlarını alma
st.subheader("Yazı Font Ayarları") uploaded_font = st.file_uploader("Font dosyasını yükleyin (TTF formatında):", type="ttf") font_size_title = st.slider("Başlık Font Boyutu", min_value=20, max_value=50, value=35) font_size_description = st.slider("Açıklama Font Boyutu", min_value=15, max_value=40, value=25)
Logo yükleme
st.subheader("Logo Ayarları") uploaded_logo = st.file_uploader("Logo dosyasını yükleyin (PNG formatında veya başka bir format):", type=["png", "jpg", "jpeg"])
Logo konumu seçimi
logo_position = st.selectbox("Logo Konumu Seçimi", ["Sol Üst", "Sağ Üst"])
Başlık ve açıklama konumlarını seçme
title_position = st.selectbox("Başlık Konumu", ["Sol", "Sağ"]) description_position = st.selectbox("Açıklama Konumu", ["Sol", "Sağ"])
RSS'den veri çekme fonksiyonu
def fetch_rss_data(rss_url, num_items): headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36' } response = requests.get(rss_url, headers=headers) rss_content = response.text
code - Assistant
- User
OSError: cannot open resource Traceback: File "C:\Users\Bounce\Desktop\CSVTOPOST\autopostcreator.py", line 94, in description_font = ImageFont.truetype(font_stream, font_size_description) File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\PIL\ImageFont.py", line 879, in truetype return freetype(font) File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\PIL\ImageFont.py", line 876, in freetype return FreeTypeFont(font, size, index, encoding, layout_engine) File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\PIL\ImageFont.py", line 288, in init load_from_bytes(cast(IO[bytes], font)) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\PIL\ImageFont.py", line 268, in load_from_bytes self.font = core.getfont( ~~~~~~~~~~~~^ "", size, index, encoding, self.font_bytes, layout_engine ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^
- Assistant
- User
- Assistant
- User
OSError: cannot open resource 2025-01-03 02:56:10.010 Uncaught app execution Traceback (most recent call last): File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\streamlit\runtime\scriptrunner\exec_code.py", line 88, in exec_func_with_error_handling result = func() File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 579, in code_to_exec exec(code, module.dict) ~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Bounce\Desktop\CSVTOPOST\autopostcreator.py", line 94, in description_font = ImageFont.truetype(font_stream, font_size_description) File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\PIL\ImageFont.py", line 879, in truetype return freetype(font) File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\PIL\ImageFont.py", line 876, in freetype return FreeTypeFont(font, size, index, encoding, layout_engine) File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\PIL\ImageFont.py", line 288, in init load_from_bytes(cast(IO[bytes], font)) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\PIL\ImageFont.py", line 268, in load_from_bytes self.font = core.getfont( ~~~~~~~~~~~~^ "", size, index, encoding, self.font_bytes, layout_engine ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ OSError: cannot open resource
- Assistant
- User
OSError: cannot open resource 2025-01-03 02:56:10.010 Uncaught app execution Traceback (most recent call last): File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\streamlit\runtime\scriptrunner\exec_code.py", line 88, in exec_func_with_error_handling result = func() File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 579, in code_to_exec exec(code, module.dict) ~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Bounce\Desktop\CSVTOPOST\autopostcreator.py", line 94, in description_font = ImageFont.truetype(font_stream, font_size_description) File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\PIL\ImageFont.py", line 879, in truetype return freetype(font) File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\PIL\ImageFont.py", line 876, in freetype return FreeTypeFont(font, size, index, encoding, layout_engine) File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\PIL\ImageFont.py", line 288, in init load_from_bytes(cast(IO[bytes], font)) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Bounce\AppData\Local\Programs\Python\Python313\Lib\site-packages\PIL\ImageFont.py", line 268, in load_from_bytes self.font = core.getfont( ~~~~~~~~~~~~^ "", size, index, encoding, self.font_bytes, layout_engine ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ OSError: cannot open resource
- Assistant