python-3.x

pypyodbc execute returns list index out of range error

橙三吉。 提交于 2021-02-10 17:26:15
问题 I have a function that runs 3 queries and returns the result of the last (using the previous ones to create the last) when I get to the 3rd query, it get a list index our of range error. I have ran this exact query as the first query (with manually entered variables) and it worked fine. This is my code: import pypyodbc def sql_conn(): conn = pypyodbc.connect(r'Driver={SQL Server};' r'Server=HPSQL31\ni1;' r'Database=tq_hp_prod;' r'Trusted_Connection=yes;') cursor = conn.cursor() return conn,

Install a python package/module from github in local folder an use it

非 Y 不嫁゛ 提交于 2021-02-10 17:11:05
问题 Issue I would like to install with pip3 a python module from github into a local folder named local_lib/ and then use it in a script, without any virtualenv . Context Here is my folder structure : . +-- local_lib/ // Folder where the package must be installed +-- my_script.py Here is the command line i use to install the path.py package from github into the local_lib/ folder : pip3 install --upgrade --target local_lib git+https://github.com/jaraco/path.py.git Here is the content of the local

Install a python package/module from github in local folder an use it

你。 提交于 2021-02-10 17:10:24
问题 Issue I would like to install with pip3 a python module from github into a local folder named local_lib/ and then use it in a script, without any virtualenv . Context Here is my folder structure : . +-- local_lib/ // Folder where the package must be installed +-- my_script.py Here is the command line i use to install the path.py package from github into the local_lib/ folder : pip3 install --upgrade --target local_lib git+https://github.com/jaraco/path.py.git Here is the content of the local

Install a python package/module from github in local folder an use it

一笑奈何 提交于 2021-02-10 17:05:02
问题 Issue I would like to install with pip3 a python module from github into a local folder named local_lib/ and then use it in a script, without any virtualenv . Context Here is my folder structure : . +-- local_lib/ // Folder where the package must be installed +-- my_script.py Here is the command line i use to install the path.py package from github into the local_lib/ folder : pip3 install --upgrade --target local_lib git+https://github.com/jaraco/path.py.git Here is the content of the local

How do I prevent a user from sending more than one message in a channel?

别来无恙 提交于 2021-02-10 17:03:35
问题 User 1: Hello! User 1: How are you? User 2: I'm good. User 2: hbu User 3: hey guys! User 1: i'm doing fine I'm trying to delete the second message from User 1 and User 2, so that any user can only send a single message. I was told to use channel.history , but I can't think of a way to compare the author's of the messages to make sure they aren't the same person. This is what I want: I want to prevent double posting: User 1: Hello! How are you? User 2: I'm good, hbu. User 3: hey guys! User 1:

How do I prevent a user from sending more than one message in a channel?

隐身守侯 提交于 2021-02-10 17:03:34
问题 User 1: Hello! User 1: How are you? User 2: I'm good. User 2: hbu User 3: hey guys! User 1: i'm doing fine I'm trying to delete the second message from User 1 and User 2, so that any user can only send a single message. I was told to use channel.history , but I can't think of a way to compare the author's of the messages to make sure they aren't the same person. This is what I want: I want to prevent double posting: User 1: Hello! How are you? User 2: I'm good, hbu. User 3: hey guys! User 1:

Python3 different behaviour between latin-1 and cp1252 when decoding unmapped characters

老子叫甜甜 提交于 2021-02-10 16:59:59
问题 I'm trying to read in Python3 a text file specifying encoding cp1252 which has unmapped characters (for instance byte 0x8d ). with open(inputfilename, mode='r', encoding='cp1252') as inputfile: print(inputfile.readlines()) I obviously get the following exception: Traceback (most recent call last): File "test.py", line 9, in <module> print(inputfile.readlines()) File "/usr/lib/python3.6/encodings/cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0]

Python3 different behaviour between latin-1 and cp1252 when decoding unmapped characters

拥有回忆 提交于 2021-02-10 16:59:33
问题 I'm trying to read in Python3 a text file specifying encoding cp1252 which has unmapped characters (for instance byte 0x8d ). with open(inputfilename, mode='r', encoding='cp1252') as inputfile: print(inputfile.readlines()) I obviously get the following exception: Traceback (most recent call last): File "test.py", line 9, in <module> print(inputfile.readlines()) File "/usr/lib/python3.6/encodings/cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0]

Python: Tkinter TclError: can't invoke “image” command

只愿长相守 提交于 2021-02-10 16:47:49
问题 preface : I have currently tried most things and there are few qusestions asked on stackoverflow on this question and i cant seem to wrap my head around it so im going to need some help application : the purpose of this program is to animate an oval and a picture, the oval works fine, but the picture is struggling, you could remove the image or alien2 and the program should run fine. CODE image form from tkinter import * import time from PIL import Image,ImageFilter from PIL import ImageTk

Pywinauto unable to find/close pop-up window

故事扮演 提交于 2021-02-10 16:47:24
问题 Source code def is_admin(): try: return ctypes.windll.shell32.IsUserAnAdmin() except: return False if is_admin(): app = Application(backend='uia').start("C:\\Program Files (x86)\\Advantech\\AdamApax.NET Utility\\Program\\AdamNET.exe") win = app['Advantech Adam/Apax .NET Utility (Win32) Version 2.05.11 (B19)'] win.wait('ready') win.menu_select("Setup->Refresh Serial and Ethernet") win.top_window().print_control_identifiers(filename="file.txt") # win.top_window().OKButton.click_input() --------