Questions tagged as 'python'

1
answer

How do I import packages from a subfolder to a folder? In python

Suppose that each folder / package already has its respective init .py If I have this composition: -Carpeta Padre | archivo1.py | | Carpeta Hija | | |archivo2.py | |_____________ | |____________________ I would li...
asked by 15.03.2018 / 20:11
1
answer

get elapsed time in django

I am creating a task in Django where I need to take all the orders and check the creation date to see how much time has elapsed, in case 2 days have passed to execute a code and in case 4 have passed, execute a different one. Right now my mod...
asked by 14.03.2018 / 07:48
3
answers

Avoid reading .py files

In the company we are developing a project with python using a raspberry. The program is already done and it is intended to market the service that makes the code so we require that you can not read or edit the file. It starts automatically thro...
asked by 14.03.2018 / 21:59
1
answer

Error = tuple index out of range ... problem with postgresql and python

I have the following function: def Buscar(self): comando="SELECT * FROM tipo_inversion where id='"+self.palabra.get()+"';" conectar=Base_de_datos.BaseDeDatos() conectar.cursor.execute(comando) #rows= conectar.cursor.fetchall()...
asked by 05.03.2018 / 02:58
1
answer

Delete rows and send text to an item in a QTableWidget

I have a problem trying to send a text to an item in a tablewidget. This is the code I use: from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5 import uic from PyQt5.Qt import * class Principal(Q...
asked by 15.07.2018 / 21:32
1
answer

Add 'alias' columns in a row with Postgresql

nombre nit colum_alias1 colum_alias2 total_alias -------------------------------------------------------------------- nombre1 1 1,500 3,000 ? nombre2 2 2,000 4,...
asked by 05.04.2018 / 21:21
1
answer

Do not insert duplicate data

I'm a bit confused, what would be the best practice to not insert duplicate data in a table, I have the following code. cnn = pyodbc.connect ( 'Driver={SQL Server};Server=**;Database=**;uid=**;pwd=**',autocommit=True ) sqlcmd = ("Select GEOM...
asked by 13.03.2018 / 12:20
1
answer

Print column name as headings with bd postgresql and python

I have the following code of a PostgreSQL table, I need you to print the name of columns as a header, with Tabulate and Python, I only get the numbering of the columns as a header, I do not know why: cur.execute("""select * from admin_eps""")...
asked by 01.03.2018 / 16:29
1
answer

'ascii' codec can not decode byte 0xc3 in position 43: ordinal not in range (128) Python

What happens is that I made a program that counts words in txt files in python, I try it for some files in English but when the files have characters like - ----- or ñ it appears Error :    'ascii' codec can not decode byte 0xc3 in position...
asked by 23.02.2018 / 20:40
1
answer

Transparency in Windows PyQt Does Not Work

Good afternoon I want to generate a transparency effect in my main window. But when executing the code the transparency is not executed and only a black background is set: This is my code: import sys from PyQt5.QtWidgets import QMainWindow,...
asked by 07.03.2018 / 20:28