Questions tagged as 'python-2.7'

2
answers

group tuples of a list [closed]

I am interested in grouping tuples of two elements of a list of tuples that share an element. How could I do this in python? For example, if I have the list [(1,2),(2,5),(3,4),(4,1),(8,2)] the answer should be [[(1,2),(2,5),(8,2)],[...
asked by 28.11.2018 / 15:26
1
answer

Error installing clarifai could not find a version that satisfies the requirement clarifai.rest (from versions :)

I'm trying to install a module called clarifai, using pip install clarifai, and it throws me the following error    could not find a version that satisfies the requirement clarifai.rest   (from versions:) from what I have read others have...
asked by 11.04.2018 / 12:21
2
answers

Get several values in a query

I have this code: cursor.execute('SELECT nom FROM productes WHERE listacompra = 1') rows = cursor.fetchall() for row in rows: print(row[0]) In the SQL database, I have two rows with something like this: id 1, nom Custard, list purc...
asked by 06.09.2017 / 17:42
1
answer

Error in PIL, image index out of range, python

Very good, I would like you to clarify a doubt. Creating a function that from a "L" image creates a matrix with the values of its pixels, it returns this:    return self.im.getpixel (xy), IndexError: image index out of range If someone ca...
asked by 21.09.2016 / 20:44
1
answer

I need to dynamically pass to the "query" object of SQLAlchemy the parameters of the class next to its attributes

I need to dynamically arm the part where the .query() gets the class of the objects and their attributes, that is, that within query dynamically insert the tables and columns received from another application. For example: sessio...
asked by 19.09.2016 / 15:17
2
answers

Python script not executed from Cron

I'm trying to run a Python script from cron. Manually functional without problems. I have already tried all the solutions that can be found on the web. The crontab file is as follows: PATH=/usr/sbin:/usr/bin:/sbin/bin:/sbin:/bin:/home/p...
asked by 27.02.2017 / 15:03
1
answer

Set the active window in a QmdiArea

I have a mdiArea to which I add several windows (of the class QWidget ): self.mdiArea.addSubWindow(self.win_ts) self.mdiArea.addSubWindow(self.win_vt) self.mdiArea.addSubWindow(self.win_norm) By default, the last window add...
asked by 13.05.2017 / 16:27
1
answer

Install mysql-python on Windows

What steps should I follow to correctly install mysql-python on my Windows operating system?     
asked by 11.02.2016 / 20:49
1
answer

Python hollow figures

I just need to know how I could turn these two figures (triangle and rhombus) into hollow figures, that is, only show their edges. my code is this: def Rombo(n): l = [[' ' for x in range(n)] for z in range(n/2+1)] for e in range(n):...
asked by 24.12.2018 / 04:18
0
answers

Error Tor AssertionError: Not supported proxy scheme socks5h

I was making a request with tor import requests proxies = {"http":"socks5h://locahost:9050","https":"socks5h://localhost:9050"} r = requests.get("http://httpbin.org/ip",proxies=proxies).content print r When executed, the error appears As...
asked by 29.12.2018 / 23:16