python

asyncio not working on Google Cloud Functions

半腔热情 提交于 2021-02-20 02:57:43
问题 I have this function which works fine locally on my machine with python 3.8, but it throws runtime error on Google Cloud Functions. def telegram_test(request): request_json = request.get_json() import datetime import pandas as pd from pyrogram import Client session_string = "...............38Q8uTHG5gHwyWD8nW6h................." # the rest of the authantication api_id = 32494131641215 api_hash = "ioadsfsjnjksfgnfriuthg#qw]/zwq ]w/\lc ec," # one of bbc channels on telegram you want to access

How to insert data into SQLite3 database with Python?

半世苍凉 提交于 2021-02-20 02:55:27
问题 I need to insert data into SQLite3 database using Python. I have written the query but it's not working as I expected. My code is below. conn = sqlite3.connect("db.sqlite3") cursor = conn.cursor() location_name = request.POST.get('lname') rname = request.POST.get('rname') seat = request.POST.get('seat') projector = request.POST.get('projector') video = request.POST.get('video') location_name = location_name[0:255] rname = rname[0:255] seat = seat[0:10] from_date = request.POST.get('from_date'

pyinstaller executable doesn't run in Ubuntu 18.04.1

落花浮王杯 提交于 2021-02-20 02:54:46
问题 I looked through other posts and they didn't seem to address the specific issue where nothing happens when I try to execute a compiled program. Not sure if this is an Ubuntu issue or a python issue... Either way I'm very new to both so I'm sure there's some simple answer to this. I wrote a simple program print("hello") input("now") and used pyinstaller to compile it into a single file. pyninstaller --onefile test.py When I try to run the file by double clicking it in the GUInothing at all

阿里云Teambition网盘移动端即将上线,号称永不限速

泪湿孤枕 提交于 2021-02-20 02:50:04
点击蓝色“ Python空间 ”关注我丫 加个“ 星标 ”,每天一起快乐的学习 来源:扩展迷EXTFANS 公众号 Python空间 后台回复" 内测 "即可获得内测资格申请。 近日,阿里巴巴旗下办公套件Teambition官方宣布,Teambition网盘移动端迷你版即将在国庆日上线,马上可以开放更多内测。 根据海报介绍,Teambition网盘国庆上线后可以查看和下载文件,再过一个月支持上传、下载、分享功能更完善,可以自定义底部导航。 此前,Teambition网盘官方介绍称,该网盘是一款团队协作工具,包含项目空间、文档、待办、日历等内容,无需登录即可在线预览或下载。 官方网站称: 上传下载不限速, Teambition网盘付不付费,都不限速。 始终是一个优雅安静的地方,没有弹窗或者广告推送。只有当你寻求支持的时候,会发现沟通的入口一直都在那里。 你的隐私绝对安全。尽管安心地存放一切影像资料。我们运用的人工智能技术,只专注于帮助你提升文件管理效率。 免登录就能下载好东西。分享和收藏东西应该更简单,即便是在未登录状态下,你和小伙伴也可以直接预览或者下载对方发送给你的各类文件。能够满足日常需求的6T存储空间。 据了解, Teambition网盘 采用邀请方式注册登录,今天是首次提供大规模移动端下载。 据新闻报道,2019年4月,阿里巴巴100

Convert an rgb mask image to coco json polygon format

吃可爱长大的小学妹 提交于 2021-02-20 02:48:02
问题 I annotated images using PixelAnnotationTool provided here: https://github.com/abreheret/PixelAnnotationTool and using the provided dictionary: { "labels": { "unlabeled": { "categorie": "void", "color": [ 0, 0, 0 ], "id": 0, "id_categorie": 0, "name": "unlabeled" }, "bicycle_motorcycle": { "categorie": "bicycle_motorcycle", "color": [ 119, 11, 32 ], "id": 1, "id_categorie": 1, "name": "bicycle_motorcycle" }, "bus": { "categorie": "bus", "color": [ 102, 51, 0 ], "id": 2, "id_categorie": 2,

Convert an rgb mask image to coco json polygon format

前提是你 提交于 2021-02-20 02:46:09
问题 I annotated images using PixelAnnotationTool provided here: https://github.com/abreheret/PixelAnnotationTool and using the provided dictionary: { "labels": { "unlabeled": { "categorie": "void", "color": [ 0, 0, 0 ], "id": 0, "id_categorie": 0, "name": "unlabeled" }, "bicycle_motorcycle": { "categorie": "bicycle_motorcycle", "color": [ 119, 11, 32 ], "id": 1, "id_categorie": 1, "name": "bicycle_motorcycle" }, "bus": { "categorie": "bus", "color": [ 102, 51, 0 ], "id": 2, "id_categorie": 2,

How to substitute variable to query SQL?

别来无恙 提交于 2021-02-20 02:43:50
问题 I have the following query line: c.execute("""insert into apps (url)""") I have variable url that I try to append in query insert. But U get Mysql sintax error There are two field in table: id - autoincrement and url 回答1: The better question should be "How to substitute value in string?" as the query you are passing to the c.execute() is of the string format. Even better, "How to dynamically format the content of the string?" In python, to do that there are many ways: Using str.format() # Way

pdfrw checkbox AS values gets unwanted parentheses

随声附和 提交于 2021-02-20 02:42:28
问题 So I'm trying to mark checkboxes in a PDF file with pdfrw. That means changing the checkboxes "AS" value from the default "/Off" to "/Yes". pdfrw is currently forcing parentheses around my "/Yes" when it writes to file, so it doesn't work. How do I keep it from adding these parentheses? My code: template_pdf = pdfrw.PdfReader(input_pdf_path) annotations = template_pdf.pages[0][/Annots] for annotation in annotations: annotation.update(pdfrw.PdfDict(AS="/Yes")) pdfrw.PdfWriter().write(output

elasticsearch-dsl查询

早过忘川 提交于 2021-02-20 02:42:20
接续上篇 ,本篇使用python的 elasticsearch-dsl 库操作elasticsearch进行查询。 7.查询 Elasticsearch 是功能非常强大的搜索引擎,使用它的目的就是为了快速的查询到需要的数据。 查询分类: 基本查询:使用 es 内置查询条件进行查询 组合查询:把多个查询组合在一起进行复合查询 过滤:查询同时,通过 filter 条件在不影响打分的情况下筛选数据 7.1、基本查询 查询前先创建一张表 1 PUT chaxun 2 { 3 " mappings " : { 4 " job " :{ 5 " properties " : { 6 " title " :{ 7 " store " : true , 8 " type " : " text " , 9 " analyzer " : " ik_max_word " 10 }, 11 " company_name " :{ 12 " store " : true , 13 " type " : " keyword " 14 }, 15 " desc " :{ 16 " type " : " text " 17 }, 18 " comments " :{ 19 " type " : " integer " 20 }, 21 " add_time " :{ 22 " type " : " date "

pdfrw checkbox AS values gets unwanted parentheses

江枫思渺然 提交于 2021-02-20 02:41:31
问题 So I'm trying to mark checkboxes in a PDF file with pdfrw. That means changing the checkboxes "AS" value from the default "/Off" to "/Yes". pdfrw is currently forcing parentheses around my "/Yes" when it writes to file, so it doesn't work. How do I keep it from adding these parentheses? My code: template_pdf = pdfrw.PdfReader(input_pdf_path) annotations = template_pdf.pages[0][/Annots] for annotation in annotations: annotation.update(pdfrw.PdfDict(AS="/Yes")) pdfrw.PdfWriter().write(output