Questions tagged as 'python'

1
answer

How can I pass a string of bytes to PDF with Python?

I am connecting to an API in which you return a PDF in bytes format and I want to know if there is any simple way to format it in PDF to be able to download it. My problem is that it returns a string of data in this format: b'%PDF-1.7 \n%\x...
asked by 22.02.2018 / 09:38
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 / 17:17
2
answers

Heritage in Django models

In Django models, when you create a class that inherits from another that is not abstract, for database purposes, it's like creating a one-to-one relationship between the two tables. Starting from the following      example: class...
asked by 15.09.2016 / 13:42
1
answer

Python Opencv + Gdal

I am developing software to calculate NDVI. What is NDVI? is a mathematical calculation with which you can determine the level of vegetation stress NDVI = NIR-RED / NIR + RED This result varies from -1 to 1 I'm using OpenCV as a library for arti...
asked by 01.08.2016 / 06:36
2
answers

Problem when interacting with dict Python

I have my following code: for noms in json_obj['nom']: Type = noms.split("-") x = Type[1] y = Type[2] Where json_obj['nom'] has the following values: [{u'nom': u'7558-802'}, {u'nom': u'7558-998'}] What I'm looking fo...
asked by 01.03.2017 / 01:11
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 / 16:03
2
answers

Click on a button to open a pdf file in python and QT

I'm a newbie programming in Python and my idea is that by clicking on the button that calls "Botonawg" a file pdf is opened. I would like this to work both in windows and systems UNIX . I use GNU-Linux ARCh ....
asked by 05.09.2016 / 00:12
1
answer

Concatenation in os.chdir

for galaxy in xrange(10): for system in xrange(499): os.chdir('E:\Scripts') os.makedirs(str(galaxy)+'_'+str(system)) os.chdir('E:\Scripts\%s_%s' % (galaxy, system) outfile = open('%s_%s', 'w') % (galaxy, system...
asked by 14.05.2017 / 00:00
2
answers

Python: Scipy.optimize Levenberg-marquardt method

I have a question about how to use the Levenberg-Marquart optimization method in scipy come several of these methods: link I have tried two methods (nelder-mead and basinhopping) and they work correctly with the following sentence: Nel...
asked by 06.09.2016 / 02:59
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 / 18:27