python почему вылезает ошибка RecursionError: maximum recursion depth exceeded при вызове функции импортированной из другого py файла

Рейтинг: 0Ответов: 0Опубликовано: 19.06.2023
  • При вызове функции из file_1 вылетает ошибка ! А при вызове функции из файла file_2 (там где находится сама функция) все норм работает ! Странно не пойму как так (

file_1.py

from file_2 import telegram_bot_sendtext    # test telegram_bot


telegram_bot_sendtext(bot_message='test 112')   # запуск нашей функции -->

file_2.py

import requests
import json


with open('telegram_bot.json', 'r') as file:
    # Чтение файла 'data.json' и преобразование
    # данных JSON в объекты Python
    data = json.load(file)
    token = data["Token"]
    chat_id = data["Chat_id"]


def telegram_bot_sendtext(bot_message: str):
   send_text = 'https://api.telegram.org/bot' + token + '/sendMessage?chat_id=' + str(chat_id) + '&parse_mode=Markdown&text=' + bot_message

   response = requests.get(send_text)
   return response.json()

Лог ошибки полный:

Traceback (most recent call last):
  File "C:\Code\GUI\Market_Intelligence_Сenter\my_base_views.py", line 30, in <module>
    telegram_bot_sendtext(bot_message='test 112')
  File "C:\Code\GUI\Market_Intelligence_Сenter\delete.py", line 32, in telegram_bot_sendtext
    response = requests.get(send_text)
  File "C:\Users\Almaz\AppData\Local\Programs\Python\Python310\xxx_env\lib\site-packages\requests\api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "C:\Users\Almaz\AppData\Local\Programs\Python\Python310\xxx_env\lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\Almaz\AppData\Local\Programs\Python\Python310\xxx_env\lib\site-packages\requests\sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Almaz\AppData\Local\Programs\Python\Python310\xxx_env\lib\site-packages\requests\sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Almaz\AppData\Local\Programs\Python\Python310\xxx_env\lib\site-packages\requests\adapters.py", line 489, in send
    resp = conn.urlopen(
  File "C:\Users\Almaz\AppData\Local\Programs\Python\Python310\xxx_env\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\Almaz\AppData\Local\Programs\Python\Python310\xxx_env\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "C:\Users\Almaz\AppData\Local\Programs\Python\Python310\xxx_env\lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "C:\Users\Almaz\AppData\Local\Programs\Python\Python310\xxx_env\lib\site-packages\urllib3\connection.py", line 400, in connect
    self.ssl_context = create_urllib3_context(
  File "C:\Users\Almaz\AppData\Local\Programs\Python\Python310\xxx_env\lib\site-packages\urllib3\util\ssl_.py", line 312, in create_urllib3_context
    context.options |= options
  File "C:\Users\Almaz\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 620, in options
    super(SSLContext, SSLContext).options.__set__(self, value)
  File "C:\Users\Almaz\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 620, in options
    super(SSLContext, SSLContext).options.__set__(self, value)
  File "C:\Users\Almaz\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 620, in options
    super(SSLContext, SSLContext).options.__set__(self, value)
  [Previous line repeated 491 more times]
RecursionError: maximum recursion depth exceeded

requirements.txt

about-time==4.2.1
aiocron==1.8
aiofiles==22.1.0
aiogram==2.25.1
aiohttp==3.8.4
aiosignal==1.3.1
aiosqlite==0.18.0
alive-progress==3.1.0
altair==4.2.2
altgraph==0.17.3
amortization==2.2.1
anyio==3.6.2
appdirs==1.4.4
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
arrow==1.2.3
art==5.9
asgiref==3.6.0
asttokens==2.2.1
astunparse==1.6.3
async-generator==1.10
async-timeout==4.0.2
asyncqt==0.8.0
asyncslot==0.3.1
attrs==22.2.0
auto-py-to-exe==2.33.0
Babel==2.9.1
backcall==0.2.0
beautifulsoup4==4.12.0
bleach==6.0.0
blinker==1.5
bottle==0.12.25
bottle-websocket==0.2.9
bs4==0.0.1
cachetools==5.3.0
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==3.1.0
click==8.1.3
click-help-colors==0.9.1
cloudpickle==2.2.1
colorama==0.4.6
comm==0.1.3
commonmark==0.9.1
contourpy==1.0.7
crispy-bootstrap5==0.7
croniter==1.3.15
cryptography==40.0.1
cssselect==1.2.0
cycler==0.11.0
Cython==0.29.33
dateparser==1.1.8
debugpy==1.6.6
decorator==5.1.1
defusedxml==0.7.1
Django==4.1.7
django-crispy-forms==2.0
django-environ==0.10.0
django_debug_toolbar==3.8.1
docutils==0.19
Eel==0.16.0
entrypoints==0.4
exceptiongroup==1.1.1
executing==1.2.0
fake-useragent==1.1.3
fastjsonschema==2.16.3
fonttools==4.39.2
fqdn==1.5.1
frozendict==2.3.8
frozenlist==1.3.3
future==0.18.3
fuzzywuzzy==0.18.0
gevent==22.10.2
gevent-websocket==0.10.1
gitdb==4.0.10
GitPython==3.1.31
grapheme==0.6.0
greenlet==2.0.2
grequests==0.6.0
h11==0.14.0
htbuilder==0.6.1
html5lib==1.1
idna==3.4
importlib-metadata==6.1.0
ipykernel==6.22.0
ipython==8.11.0
ipython-genutils==0.2.0
ipywidgets==8.0.5
isoduration==20.11.0
iteration-utilities==0.11.0
jedi==0.18.2
Jinja2==3.1.2
jmespath==1.0.1
joblib==1.2.0
json5==0.9.11
jsonpath==0.82
jsonpath-ng==1.5.3
jsonpointer==2.3
jsonschema==4.17.3
jupyter-events==0.6.3
jupyter-ydoc==0.2.3
jupyter_client==8.1.0
jupyter_core==5.3.0
jupyter_server==2.5.0
jupyter_server_fileid==0.8.0
jupyter_server_terminals==0.4.4
jupyter_server_ydoc==0.8.0
jupyterlab==3.6.2
jupyterlab-pygments==0.2.2
jupyterlab-widgets==3.0.6
jupyterlab_server==2.21.0
kiwisolver==1.4.4
Levenshtein==0.21.0
loguru==0.6.0
lxml==4.9.2
magic-filter==1.0.9
markdown-it-py==2.2.0
MarkupSafe==2.1.2
matplotlib==3.7.1
matplotlib-inline==0.1.6
mdurl==0.1.2
MetaTrader5==5.0.44
mistune==2.0.5
more-itertools==9.1.0
multidict==6.0.4
multitasking==0.0.11
nbclassic==0.5.3
nbclient==0.7.2
nbconvert==7.2.10
nbformat==5.8.0
nest-asyncio==1.5.6
nodeenv==1.7.0
notebook==6.5.3
notebook_shim==0.2.2
notifiers==1.3.3
numpy==1.24.2
outcome==1.2.0
packaging==23.0
pandas==1.5.3
pandocfilters==1.5.0
parse==1.19.0
parso==0.8.3
path==16.6.0
pefile==2023.2.7
pickleshare==0.7.5
Pillow==9.4.0
platformdirs==3.1.1
ply==3.11
prettytable==3.6.0
prometheus-client==0.16.0
prompt-toolkit==3.0.38
protobuf==4.22.1
psutil==5.9.4
psycopg==3.1.8
psycopg2==2.9.5
pure-eval==0.2.2
pyarrow==11.0.0
pyasn1==0.4.8
pycparser==2.21
pydeck==0.8.0
pyecharts==2.0.2
pyee==8.2.2
Pygments==2.14.0
pyinstaller==5.9.0
pyinstaller-hooks-contrib==2023.1
Pympler==1.0.1
pynvml==11.5.0
pyodbc==4.0.35
pyOpenSSL==23.1.0
pyparsing==3.0.9
pyperclip==1.8.2
pypiwin32==223
pyppeteer==1.0.2
PyQt5==5.15.9
pyqt5-plugins==5.15.9.2.3
PyQt5-Qt5==5.15.2
PyQt5-sip==12.11.1
PyQt5-stubs==5.15.6.0
pyqt5-tools==5.15.9.3.3
PyQt6==6.4.2
PyQt6-Qt6==6.4.3
PyQt6-sip==13.4.1
pyquery==2.0.0
pyrec==0.2.1
pyright==1.1.300
pyrsistent==0.19.3
PySocks==1.7.1
pyTelegramBotAPI==4.12.0
python-dateutil==2.8.2
python-dotenv==1.0.0
python-json-logger==2.0.7
pytz==2023.2
pytz-deprecation-shim==0.1.0.post0
PyWavelets==1.4.1
pywebio==1.8.2
pywin32==305
pywin32-ctypes==0.2.0
pywinpty==2.0.10
PyYAML==6.0
pyzmq==25.0.2
qt5-applications==5.15.2.2.3
qt5-tools==5.15.2.1.3
qtgui==0.0.1
rapidfuzz==3.0.0
regex==2023.3.23
requests==2.28.2
requests-html==0.10.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rfc3987==1.3.8
rich==13.3.2
scalene==1.5.20
schedule==1.1.0
scikit-learn==1.2.2
scipy==1.10.1
seaborn==0.12.2
selenium==4.8.3
semver==2.13.0
Send2Trash==1.8.0
simplejson==3.18.4
six==1.16.0
smmap==5.0.0
sniffio==1.3.0
sortedcontainers==2.4.0
soupsieve==2.4
sqlparse==0.4.3
stack-data==0.6.2
supertools==1.0.1
tabulate==0.9.0
tangled-up-in-unicode==0.2.0
telebot==0.0.5
telegram-notifier==0.3
terminado==0.17.1
testpath==0.6.0
threadpoolctl==3.1.0
tinycss2==1.2.1
tomli==2.0.1
toolz==0.12.0
tornado==6.2
tqdm==4.65.0
traitlets==5.9.0
trio==0.22.0
trio-websocket==0.10.2
typing_extensions==4.5.0
tzdata==2023.2
tzlocal==4.3
ua-parser==0.16.1
uri-template==1.2.0
urllib3==1.26.15
user-agents==2.2.0
validators==0.20.0
w3lib==2.1.1
watchdog==3.0.0
wcwidth==0.2.6
webcolors==1.12
webencodings==0.5.1
websocket-client==1.5.1
websockets==10.4
Werkzeug==2.2.3
whichcraft==0.6.1
widgetsnbextension==4.0.6
win32-setctime==1.1.0
windows-curses==2.3.1
wsproto==1.2.0
y-py==0.5.9
yarl==1.8.2
yfinance==0.2.18
ypy-websocket==0.8.2
zipp==3.15.0
zope.event==4.6
zope.interface==6.0

Ответы

Ответов пока нет.