Questions tagged as 'python'

1
answer

Name error: Name "server" not defined Python

Hello, I have a version of Python 2.7 and at this moment I do not know why this error is returned when configuring a TCP server.    server = server.socket (socket.AF_INET, socket.SOCK_STREAM)   NameError: name 'server' is not defined...
asked by 28.12.2016 / 17:46
1
answer

Problem with Django multitenant rendering

I have a project called ripso_v2 in python3 and django 1.9 that by now has a couple of apps (created with the startapp and to which I added the file urls.py and forms.py) called "general" and "phva", the main folder of the project and a folder f...
asked by 03.02.2016 / 16:07
2
answers

Render a JSON in a bootstrap table Django REST framework

I have a model that I have called Empleado which has a foreign key to a model Direccion to keep a record of the employee's addresses. Serializer: from rest_framework import serializers from models import Empleado, Direccion...
asked by 03.02.2016 / 19:20
1
answer

Handling lists in python

I want to make a small application in python, what what to do is to be in the background listening to the messages it receives, to forward them to another array. I have a dictionary like this: from_to_redir = { "1447316562" : 1487212331,...
asked by 05.12.2018 / 15:36
1
answer

Migrate from Python2 to Python3.x?

I request support by migrating the version that is currently installed in "Azure" when creating an application in Django in " Kudu Engine ". The following image shows the installed version " Python 2.7.15 ". A thousand thanks     
asked by 28.11.2018 / 22:11
1
answer

Some way to return a list using Python classes

I'm doing a small example with classes in Python but I want you to print a list of elements so use __str__ but I mark the error that it was not a type string here is my code: class intSet(object): def __init__(self):...
asked by 12.07.2017 / 18:40
1
answer

because it works when importing cv2 and cv does not work when I import it

I'm trying this import numpy as np import cv2 #Cargar los dos videos video1 = cv2.VideoCapture('video1.mov') video2 = cv2.VideoCapture('video2.mov') #Guardar las dimensiones del primer video ancho1 = int(video1.get(cv2.cv.CV_CAP_PROP_FRAME_W...
asked by 10.07.2017 / 01:24
1
answer

Difference between iterable objects, iterator and containers in Python 3

I have seen that in Python 3 there are iterable objects, objects iterator and there are also containers . My questions are: What is the difference? Can everyone walk in a loop? In all of them can its elements be accessed through indexes?...
asked by 08.07.2017 / 02:40
1
answer

Error with Sorted Python 3

Good, I have an error when ordering. I pass the method and the error it gives. I modified the Sorted line and it does not give me any errors so I guess the error is there def selection_and_reproduction(poblacionNueva): puntuados = [(calcularF...
asked by 12.07.2017 / 18:14
2
answers

Error installing mysql-python

I'm trying to install the pip module with mysql-python in a Windows 7 Professional. The fact is that I'm getting this error: C:\Users_027>pip install mysql-python Collecting mysql-python Using cached MySQL-python-1.2.5.zi...
asked by 05.04.2016 / 09:54