Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-28 Thread Peter Otten
Jan Gosmann wrote: > On 27 Mar 2017, at 18:30, Peter Otten wrote: > >> Are you perchance comparing 32-bit Python 3.5 with 64-bit Python 3.6? > > I don't think so. > [sys.maxsize](https://docs.python.org/3/library/platform.html#cross-platform) > indicates both to be 64-bit. While my original ide

newbie question re classes and self

2017-03-28 Thread loial
Can I pass self(or all its variables) to a class? Basically, how do I make all the variables defined in self in the calling python script available to the python class I want to call? -- https://mail.python.org/mailman/listinfo/python-list

Re: Logging from different python scripts to different output files

2017-03-28 Thread Peter Otten
James McMahon wrote: > I'm struggling with Python logging. Have tried to apply several examples I > have found in the open source literature, but can't get it to work. What I > need to do is this: I have two python scripts, a.py and b.py. Each is > called by NiFi ExecuteScript processor repeatedly

Re: newbie question re classes and self

2017-03-28 Thread Peter Otten
loial wrote: > Can I pass self(or all its variables) to a class? > > Basically, how do I make all the variables defined in self in the calling > python script available to the python class I want to call? Inside a method you can access attributes of an instance as self.whatever: >>> class A: ..

how to group own any one common in the list?

2017-03-28 Thread Ho Yeung Lee
aaa = ["a","ab","c","b","bc"] def similar(aa): similarset = [] for ii in range(0,len(aa)): for jj in range(ii,len(aa)): if ii <> jj: print("("+str(ii)+","+str(jj)+")") if (aa[ii] in aa[jj]) or (aa[jj] in aa[ii]): print

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-28 Thread INADA Naoki
I can't reproduce it. I managed to install pyopencl and run the script. It takes more than 2 hours, and uses only 7GB RAM. Maybe, some faster backend for OpenCL is required? I used Microsoft Azure Compute, Standard_A4m_v2 (4 cores, 32 GB memory) instance. More easy way to reproduce is needed...

Re: newbie question re classes and self

2017-03-28 Thread Terry Reedy
On 3/28/2017 4:09 AM, loial wrote: Can I pass self(or all its variables) to a class? In Python, every argument to every function is an instance of some class. The function can access any attribute of the arguments it receives with arg.attribute. -- Terry Jan Reedy -- https://mail.python.o

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-28 Thread Jan Gosmann
On 28 Mar 2017, at 3:08, Peter Otten wrote: > Perhaps numpy's default integer type has changed (assuming you are using > integer arrays, I did look at, but not into your code)? > > You could compare > numpy.array([42]).itemsize > 8 > > for the two interpreters. Both report 8 for integer and

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-28 Thread Jan Gosmann
On 28 Mar 2017, at 6:11, INADA Naoki wrote: I managed to install pyopencl and run the script. It takes more than 2 hours, and uses only 7GB RAM. Maybe, some faster backend for OpenCL is required? I used Microsoft Azure Compute, Standard_A4m_v2 (4 cores, 32 GB memory) instance. I suppose that

AH01215: ImportError: No module named PIL: - python script unable to recognize PIL when running from apache2 config

2017-03-28 Thread vishnuprasadh
What did you do? I have configured in apache httpd.conf - enabling of mod_cgi.so and httpd-vhosts.conf. In httpd-vhosts have following conifguration. Basically am trying to capture all /images/ pattern, read have that process using a index.py script and return back as image/jpeg content. Ser

Re: AH01215: ImportError: No module named PIL: - python script unable to recognize PIL when running from apache2 config

2017-03-28 Thread Chris Angelico
On Wed, Mar 29, 2017 at 2:59 AM, wrote: > Please help if this wont resolve, I have to completely move away from python. How about, instead, moving away from CGI? Switch to Apache's modpython. I've deployed several Python-based web sites without difficulties. ChrisA -- https://mail.python.org/m

Re: Using/compiling pyuno with Python 3.6

2017-03-28 Thread Jim
On 03/27/2017 11:41 PM, Deborah Swanson wrote: filtered wrote, on March 27, 2017 9:09 PM Sorry but all your answers are pointless. I clearly asked about compiling PyUno MYSELF with a self-compiled Python 3.6.1 installation. Is this so hard to understand? Why do you give unrelated comments to a

Re: AH01215: ImportError: No module named PIL: - python script unable to recognize PIL when running from apache2 config

2017-03-28 Thread Chris Angelico
On Wed, Mar 29, 2017 at 3:32 AM, Karim wrote: > > On 28/03/2017 18:05, Chris Angelico wrote: >> >> On Wed, Mar 29, 2017 at 2:59 AM, wrote: >>> >>> Please help if this wont resolve, I have to completely move away from >>> python. >> >> How about, instead, moving away from CGI? Switch to Apache's

Re: AH01215: ImportError: No module named PIL: - python script unable to recognize PIL when running from apache2 config

2017-03-28 Thread Karim
On 28/03/2017 18:35, Chris Angelico wrote: On Wed, Mar 29, 2017 at 3:32 AM, Karim wrote: On 28/03/2017 18:05, Chris Angelico wrote: On Wed, Mar 29, 2017 at 2:59 AM, wrote: Please help if this wont resolve, I have to completely move away from python. How about, instead, moving away from C

Proper way to run CherryPy app as a daemon?

2017-03-28 Thread Israel Brewster
I am wanting to run a CherryPy app as a daemon on CentOS 6 using an init.d script. By subscribing to the "Daemonizer" and PIDFile cherrypy plugins, I have been able to write an init.d script that starts and stops my CherryPy application. There's only one problem: it would appear that the program

Re: Program uses twice as much memory in Python 3.6 than in Python 3.5

2017-03-28 Thread INADA Naoki
On Wed, Mar 29, 2017 at 12:29 AM, Jan Gosmann wrote: > On 28 Mar 2017, at 6:11, INADA Naoki wrote: > >> I managed to install pyopencl and run the script. It takes more than >> 2 hours, and uses only 7GB RAM. >> Maybe, some faster backend for OpenCL is required? >> >> I used Microsoft Azure Comput

Multiprocessing queue in py2.7

2017-03-28 Thread Frank Miles
I tried running a bit of example code from the py2.7 docs (16.6.1.2. Exchanging objects between processes) only to have it fail. The code is simply: # from multiprocessing import Process, Queue def f(q): q.put([42, None, 'hello']) if __name__ == '__main__': q = Queue()

Re: Multiprocessing queue in py2.7

2017-03-28 Thread MRAB
On 2017-03-28 19:51, Frank Miles wrote: I tried running a bit of example code from the py2.7 docs (16.6.1.2. Exchanging objects between processes) only to have it fail. The code is simply: # from multiprocessing import Process, Queue def f(q): q.put([42, None, 'hello']) if _

Re: Multiprocessing queue in py2.7

2017-03-28 Thread Terry Reedy
On 3/28/2017 2:51 PM, Frank Miles wrote: I tried running a bit of example code from the py2.7 docs (16.6.1.2. Exchanging objects between processes) only to have it fail. The code is simply: # from multiprocessing import Process, Queue def f(q): q.put([42, None, 'hello']) if

pandas creating a new column based on row values

2017-03-28 Thread zljubisic
This doesn't work: import pandas as pd def myfunc(): return 'Start_{}_{}_{}_{}_End'.format(df['coverage'], df['name'], df['reports'], df['year']) data = {'name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'], 'year': [2012, 2012, 2013, 2014, 2014], 'reports': [4, 24, 31, 2, 3],

Re: pandas creating a new column based on row values

2017-03-28 Thread codewizard
On Tuesday, March 28, 2017 at 3:36:57 PM UTC-4, zlju...@gmail.com wrote: > [snip] > > Can I somehow generate a new column by concatenating values for the other > columns in a row? > Try this (not tested): def myfunc(row): return 'Start_{}_{}_{}_{}_End'.format(row['coverage'], row['name'],

Re: AH01215: ImportError: No module named PIL: - python script unable to recognize PIL when running from apache2 config

2017-03-28 Thread Terry Reedy
On 3/28/2017 11:59 AM, vishnupras...@gmail.com wrote: I capture following error in apache logs. AH01215: from PIL import Image: /var/www/images/index.py AH01215: ImportError: No module named PIL: /var/www/images/index.py A general response to this particular message is a) check spelling in cod

Re: Multiprocessing queue in py2.7

2017-03-28 Thread Frank Miles
On Tue, 28 Mar 2017 15:38:38 -0400, Terry Reedy wrote: > On 3/28/2017 2:51 PM, Frank Miles wrote: >> I tried running a bit of example code from the py2.7 docs >> (16.6.1.2. Exchanging objects between processes) >> only to have it fail. The code is simply: >> # >> from multiprocessi

Re: pandas creating a new column based on row values

2017-03-28 Thread zljubisic
It works. Thank you very much. :) -- https://mail.python.org/mailman/listinfo/python-list

pandas dataframe, find duplicates and add suffix

2017-03-28 Thread zljubisic
In dataframe import pandas as pd data = {'model': ['first', 'first', 'second', 'second', 'second', 'third', 'third'], 'dtime': ['2017-01-01_112233', '2017-01-01_112234', '2017-01-01_112234', '2017-01-01_112234', '2017-01-01_112234', '2017-01-01_112235', '2017-01-01_112235'], }