1

Actual Behavior

I have a script sending message to the Telegram Messenger API.

When I run it in Spyder, everything is ok.

When I use the batch created using "C:\Users\Alex\anaconda3\python.exe" as path in my txt file, I have the following errors (in Anaconda Prompt)


 "Can't connect to HTTPS URL because the SSL module is not available."
urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

"requests.exceptions.SSLError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot9[confidential url] (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))"

Expected Behavior

When I launch my script in SPyder, everything is ok : I receive the text I want to receive on my Instagram messenger account. I would like to be able to do the same with my batch file.

Steps to Reproduce

I have a script as follow : def telegram_bot_sendtext(bot_message):

bot_token = 'token'
bot_chatID = '-id'
send_text = 'https://api.telegram.org/bot' + bot_token + '/sendMessage?chat_id=' + bot_chatID + '&parse_mode=Markdown&text=' + bot_message
response = requests.get(send_text)

return response.json()

telegram_bot_sendtext("text")

I created the batch file using : "C:\Users\Alex\anaconda3\python.exe" "C:\Users\Alex\Desktop\U\project.py" pause

Anaconda or Miniconda version:

Anaconda3 . 2020.02

Operating System:

I'm on Windows 10 v1903

Alex Dana
  • 554
  • 4
  • 22
  • I would assume, you'd need to tell it where to find modules! Is the module to be found somewhere within `sys.path` / `PYTHONPATH`? If not what did you do to include/append it? You really haven't given us enough information or code upon which to base ideas or solutions. – Compo Apr 10 '20 at 11:28
  • My god it's refreshing to see such a well-written question. I don't have Anaconda3 installed so I can't test this, but based on [this answer](https://stackoverflow.com/a/55632553/4158862) that I see you already found, you should only have to add `set "path=%path%;%userprofile%\Anaconda3;%userprofile%\Anaconda3\scripts;%userprofile%\Anaconda3\Library\bin"` to the start of your batch script. – SomethingDark Apr 10 '20 at 11:32
  • Refreshing perhaps @SomethingDark, but instead, what should have happened, is that they edited [their first attempt](https://stackoverflow.com/q/61124477), and tried to have it reopened, not post it again with changes. – Compo Apr 10 '20 at 11:41

0 Answers0