当我在 pythonanywhere 上部署我的机器人时,我无法向我的机器人发送消息。由于 telegram 不再支持通配符证书,如博客文章的官方 pythonanywhere 博客链接中所述,出现无法连接到服务器的错误。如果有人知道此问题的解决方案,请帮助我
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bottokenvalue/sendMessage (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f094debf050>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
2020-01-17 21:58:04,377: Retrying (Retry(total=2, connect=None, read=None, redirect=0, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f094da4c610>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /bottoken/sendMessage
2020-01-17 21:58:05,377: Retrying (Retry(total=1, connect=None, read=None, redirect=0, status=None)) after connection broken …
Run Code Online (Sandbox Code Playgroud) 所以我尝试在 Discord 中创建一个机器人,并尝试在 Gitpod 上运行我的 Discord 机器人,它能够运行,但是当我尝试在 pythonanywhere.com 上运行它时,我收到此错误:
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discordapp.com:443 ssl:default [Connect call failed ('162.159.134.233', 443)]
Run Code Online (Sandbox Code Playgroud)
这是我的代码片段:
import discord
from discord.ext import commands
import json
with open("credentials.json") as creds:
creds = json.loads(creds.read())
TOKEN = creds["TOKEN"]
client = discord.Client()
class Bot(commands.Bot):
def __init__(self):
super(Bot, self).__init__(command_prefix="$", case_insensitive=True)
self.pool = None
bot = Bot()
@bot.event
async def on_ready():
print('Logged in as')
print(bot.user)
print('------')
# calculate
@bot.command()
async def calculate(ctx):
await ctx.send("foo")
bot.run(TOKEN)
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激。
我正在尝试使用以下命令安装html2text:
>>pip install --username html2text
Run Code Online (Sandbox Code Playgroud)
并且我一直收到'语法错误'和指向"安装"中最后一个"l"的箭头...
我在 pythonanywhere 服务器上托管了一个 django 应用程序。几天前,在编辑本网站时,我在 settings.py 文件中添加了一些关于 https 和 ssl 连接的变量。
显然,当我没有证书时,我不想要 https,但我忘记了设置文件中的那些变量。
上传文件后,进入网站,我看到我已经忘记了那些变量。我立即从设置文件中删除了变量并重新上传,但问题仍然存在。我的意思是,如果我访问该站点,则会重定向到我不想要的 https。结果是“连接不是私有的”,带有红色禁止 https。
你能告诉我如何解决这个问题吗?如何删除自动重定向到 https 并避免消息“连接不是私有的”?
先感谢您!!!
编辑:
我知道如果我去http://siteaddress一切正常。但是如果在地址栏中你只输入 www.siteaddres.com 它会自动重定向到https://www.siteaddress.com
我试图将一个克隆拉入pythonanywhere.
我跑:
git clone https://github.com/<your-github-username>/my-first-blog.git
Run Code Online (Sandbox Code Playgroud)
我得到以下语法错误:
File < stdin>, line 1
git clone https://github.com/yavorcik/my-first-blog.git
^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
不知道我在这里做错了什么.
I have a free account on PythonAnywhere from where I am trying to run the following script that locally works just fine.
I am wondering if the error I get is for technical reasons or just that PythonAnywhere forbids people to scrap from their platform for certain websites only?
Do you know of other free websites where I would be allowed to scrap anything?
import requests
from bs4 import BeautifulSoup as bs
def scrapMarketwatch(address):
#creating formatting data from scrapdata
r …
Run Code Online (Sandbox Code Playgroud) 我正在尝试安装bigfloat
,我收到的消息似乎表明我mpfr
首先需要该库.我该怎么做呢?
消息:
运行build_ext构建'mpfr'扩展创建build/temp.linux-x86_64-2.7 x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I /usr/include/python2.7 -c mpfr.c -o build/temp.linux-x86_64-2.7/mpfr.o mpfr.c:344:18:致命错误:mpfr.h:没有这样的文件或目录#include"mpfr.h"^编译终止.错误:命令'x86_64-linux-gnu-gcc'以退出状态1失败
我是python和pythonanywhere的新手,所以我不知道如何安装库.
我试图找到如何使用谷歌安装库,我试图使用:
pip install --user mpfr
Run Code Online (Sandbox Code Playgroud)
但我收到此错误消息:
收集mpfr无法找到满足要求的版本mpfr(来自版本:)没有为mpfr找到匹配的分发
我是Python Anywhere的新手,我正在尝试建立一个已经构建的Flask Web应用程序。我遵循了本教程:https : //help.pythonanywhere.com/pages/Flask/
但是,当我尝试访问该站点时,日志显示以下内容:
Error running WSGI application
2018-07-24 11:25:47,696: ModuleNotFoundError: No module named 'flask_app'
2018-07-24 11:25:47,697: File "/var/www/vdvaxel_pythonanywhere_com_wsgi.py", line 111, in <module>
2018-07-24 11:25:47,697: from flask_app import app as application # noqa
Run Code Online (Sandbox Code Playgroud)
我一步一步地遵循了本教程,但是仍然行不通。有人可以解释我哪里错了吗?
我在 PythonAnywhere 上有一个网站,它使用 Flask 和 Flask-SQLAlchemy 连接到 MySQL 数据库。用户可以使用网站将一个任务进行排队,作为记录保存到数据库中,然后一个单独的计划任务(Python 程序)检查数据库并处理每个未处理的记录。
我遇到的问题是计划任务的数据库查询似乎只有在第一次运行时才找到新记录,但是如果我随后使用网站添加新任务,仍在运行的计划任务的重复数据库查询(每 5 秒)似乎没有检测到新记录。
关于这里可能发生什么的任何想法?
这是 bash 文件运行的代码:
def generate_any_pending_videos():
unfinished_videos = db.session.query(Video)\
.filter(~Video.status.has(VideoStatus.status.in_(['Error', 'Finished', 'Video deleted'])))\
.order_by(Video.datetime_created)\
.all()
for video in unfinished_videos:
try:
logging.info("Attempting to create video for video %d" % video.id)
generate_video(video)
except Exception as e:
logging.error(str(e))
if __name__ == '__main__':
while True:
generate_any_pending_videos()
time.sleep(5)
Run Code Online (Sandbox Code Playgroud) 我想使用pickle模块,将我电脑上学到的模型序列化:
pickle.dump(clf, open(os.path.join(dest, 'classifier.pkl'), 'wb'), protocol=4)
Run Code Online (Sandbox Code Playgroud)
当我也在我的电脑上打开它时,一切正常:
clf = pickle.load(open(os.path.join('pkl_objects', 'classifier.pkl'), 'rb'))
Run Code Online (Sandbox Code Playgroud)
不幸的是,当我在pythonanywhere.com上做同样的事情时,我得到了错误:
ModuleNotFoundError: No module named 'sklearn.linear_model._stochastic_gradient'
Run Code Online (Sandbox Code Playgroud)
我有以下版本的 scikit-learn:
如何标准化?
pythonanywhere ×10
python ×6
flask ×2
python-3.x ×2
discord ×1
discord.py ×1
django ×1
git ×1
gnu ×1
https ×1
mpfr ×1
mysql ×1
pickle ×1
scikit-learn ×1
ssl ×1
telegram ×1
telegram-bot ×1
telepot ×1
web-scraping ×1