After update to pip 10 I get: Cache entry deserialization failed, entry ignored

2018-04-18 Thread Cecil Westerhof
After I updated pip2/3 to 10 from 9 I sometimes get:
Cache entry deserialization failed, entry ignored

For example when I execute:
pip3 list --outdated

But not always.

What could be happening here? And how would I solve this?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


Regex for changing :variable to ${variable} in sql query

2018-04-18 Thread zljubisic
Hi,

I have a sql query in which all variables declared as :variable should be 
changed to ${variable}. 

for example this sql:

select * 
from table 
where ":x" = "1" and :y=2
and   field in (:string)
and   time between :from and  :to


should be translated to:

select * 
from table 
where "${x}" = "1" and ${y} = 2
and   field in ( ${string} )
and   time between ${from} and ${to}

As far as I have come is to find the group as (:(.+?)\b)
and than replace it as ${$2} 

(it would be nice if before and after the ${variable} it is always one space)

For opposite change (from ${variable} notation to :variable) I am using:

sql.replace('${', ':').replace('}', '')

Can someone please help?

Regards.
-- 
https://mail.python.org/mailman/listinfo/python-list


Flask test generator code review?

2018-04-18 Thread Albert-Jan Roskam
Hi,

I am writing my first unittests for a Flask app. First modest goal is to test 
whether a selected subset of the templates return the expected status 200. 
I am using a nose test generator in a class for this. Is the code below the 
correct way to do this? And is there a way to dynamically set the docstring of 
test_generator? This would make the nosetests output a bit more understandable. 

Thanks!
Albert-Jan

import os
import sys
from os.path import splitext
from http import HTTPStatus as status

import nose

from MyFabulousApp import app

app.testing = True
template_folder = app.config['TEMPLATE_FOLDER']


class Test_MyFabulousApp_HTTP_Status_OK:

def __init__(self):
self.setup()   # with unittest, setUp is called automatically, but not 
with nose

def setup(self):
self.client = app.test_client()
self.client.post('/login', follow_redirects=True)

def teardown(self):
self.client.post('/logout', follow_redirects=True)

def test_generator(self):
"""Does template return HTTP Status 200?"""
def the_test(self, template):
# the following line throws an error: AttributeError: attribute 
'__doc__' of 'method' objects is not writable
#self.test_generator.__doc__ = 'Does template "%s" return HTTP 
Status 200?' % template
respons = self.client.get('/' + template)
actual = respons.status_code
desired = status.OK.value
assert actual == desired, \
   'Template "%s" returns status code %d' % (template, actual)
templates = [splitext(item)[0] for item in os.listdir(template_folder)]
for template in templates:
yield the_test, self, template


if __name__ == '__main__':
nose.run(defaultTest=__name__, argv=[sys.argv[0], '__main__', 
'--verbosity=2'])
-- 
https://mail.python.org/mailman/listinfo/python-list


how to create auto generated mail from robo framework upon execution completion of TCs

2018-04-18 Thread supswain
Hi,

I am having below setup 

robofraemwork setup info -> Robot Framework 2.8.1 32 bit
python->Python 2.7.6 32 bit
OS->windows 7 64 bit



I am running test cases from Robo  framework  and want to create any library 
proc through which I can get auto generated mail from robo-framework  regarding 
execution of the Tcs  upon completion of execution.


I want the mail message body to be as below

1->name of the TC
2->execution status
3->path to find execution log for the TC


Could anyone please help me on this.

Thanks,
Supriya
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New PyPI launched, legacy PyPI shutting down April 30

2018-04-18 Thread Noah
Awesome

On Mon, Apr 16, 2018 at 8:21 PM, Laura Hampton 
wrote:

> New PyPI launched, legacy PyPI shutting down April 30[1]
>
> Starting today, the canonical Python Package Index is at https://pypi.org
> and uses the new Warehouse codebase.  We announced the https://pypi.org
> beta on March 26 and your feedback and test usage have helped us get it
> production-ready.
>
> Monday April 16 (2018-04-16): We launched the new PyPI, redirecting
> browser traffic and API calls (including "pip install") from
> pypi.python.org to the new site. The old codebase is still available at
> https://legacy.pypi.org for now.
>
> Monday April 30 (2018-04-30): We plan to shut down legacy PyPI
> https://legacy.pypi.org . The address pypi.python.org will continue to
> redirect to Warehouse.
>
> For more details, see our roadmap: https://wiki.python.org/psf/
> WarehouseRoadmap
>
> If your site/service links to or uses pypi.python.org, you should start
> using pypi.org instead: https://warehouse.readthedocs.
> io/api-reference/integration-guide/#migrating-to-the-new-pypi
>
> Thank you.
>
> [1] https://blog.python.org/2018/04/new-pypi-launched-legacy-
> pypi-shutting.html
>
>   Laura Hampton
>   laura at laura-hampton dot com
> --
> https://mail.python.org/mailman/listinfo/python-announce-list
>
> Support the Python Software Foundation:
> http://www.python.org/psf/donations/
>



-- 
*./noah*
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New PyPI launched, legacy PyPI shutting down April 30

2018-04-18 Thread Jon Ribbens
Going live with the new site while its search function is mostly
inoperative seems a bit brave.

https://github.com/pypa/warehouse/issues/3746

On 2018-04-18, Noah  wrote:
> Awesome
>
> On Mon, Apr 16, 2018 at 8:21 PM, Laura Hampton 
> wrote:
>
>> New PyPI launched, legacy PyPI shutting down April 30[1]
>>
>> Starting today, the canonical Python Package Index is at https://pypi.org
>> and uses the new Warehouse codebase.  We announced the https://pypi.org
>> beta on March 26 and your feedback and test usage have helped us get it
>> production-ready.
>>
>> Monday April 16 (2018-04-16): We launched the new PyPI, redirecting
>> browser traffic and API calls (including "pip install") from
>> pypi.python.org to the new site. The old codebase is still available at
>> https://legacy.pypi.org for now.
>>
>> Monday April 30 (2018-04-30): We plan to shut down legacy PyPI
>> https://legacy.pypi.org . The address pypi.python.org will continue to
>> redirect to Warehouse.
>>
>> For more details, see our roadmap: https://wiki.python.org/psf/
>> WarehouseRoadmap
>>
>> If your site/service links to or uses pypi.python.org, you should start
>> using pypi.org instead: https://warehouse.readthedocs.
>> io/api-reference/integration-guide/#migrating-to-the-new-pypi
>>
>> Thank you.
>>
>> [1] https://blog.python.org/2018/04/new-pypi-launched-legacy-
>> pypi-shutting.html
>>
>>   Laura Hampton
>>   laura at laura-hampton dot com
>> --
>> https://mail.python.org/mailman/listinfo/python-announce-list
>>
>> Support the Python Software Foundation:
>> http://www.python.org/psf/donations/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: please test the new PyPI (now in beta)

2018-04-18 Thread Jon Ribbens
On 2018-03-27, Chris Angelico  wrote:
> Any time you see something that requires JavaScript for this, you know
> you've found a web site that dates back to... uhh, actually I don't
> know. I only have versioning info on MDN back as far as HTML 4.01 ergo
> 1999, and the placeholder attribute is there. Of course, that doesn't
> mean everyone *used* it, but it was certainly available.

'placeholder' was most certainly not in HTML 4 - it was an HTML 5
addition (i.e. it was standardised in 2014). Browser support arrived
mainly in 2011/2012, so if a web site is 5 years old it probably could
not have relied on this feature.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Finding set difference between ranges

2018-04-18 Thread Neil Cerutti
On 2018-04-18, tejaswi prakash  wrote:
> Hello all,
> I have 3 continuous (steps of 1) ranges a,a1,a2. All of them sorted.
> I am performing the following operations on them
>
> a = a.difference (a1)
> a = a.difference(a2)

If they are each stored as a set I don't see how they can be
sorted. Are you converting to set and then calling difference?

It may still be more efficient than writing your own loop to take
advantage of the sorted status of the original objects.

-- 
Neil Cerutti

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New PyPI launched, legacy PyPI shutting down April 30

2018-04-18 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Apr 16, 2018 at 01:21:50PM -0400, Laura Hampton wrote:
> New PyPI launched, legacy PyPI shutting down April 30[1]  
> 
> Starting today, the canonical Python Package Index is at https://pypi.org and 
> uses the new Warehouse codebase.  We announced the https://pypi.org beta on 
> March 26 and your feedback and test usage have helped us get it 
> production-ready.  

Search seems to be broken:
> https://pypi.org/search/?q=numpy
There were no results for 'numpy' 

Zbyszek
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New PyPI launched, legacy PyPI shutting down April 30

2018-04-18 Thread Tony van der Hoff
On 18/04/18 13:15, Zbigniew Jędrzejewski-Szmek wrote:
> On Mon, Apr 16, 2018 at 01:21:50PM -0400, Laura Hampton wrote:
>> New PyPI launched, legacy PyPI shutting down April 30[1]  
>>
>> Starting today, the canonical Python Package Index is at https://pypi.org 
>> and uses the new Warehouse codebase.  We announced the https://pypi.org beta 
>> on March 26 and your feedback and test usage have helped us get it 
>> production-ready.  
> Search seems to be broken:
>> https://pypi.org/search/?q=numpy
> There were no results for 'numpy' 
>
> Zbyszek
*Using your link:
2,797* projects for "/numpy/"

-- 
https://mail.python.org/mailman/listinfo/python-list


Generating list of rsquared_adj regression values for variating i with loop

2018-04-18 Thread Alexander Hempfing via Python-list
Dear all, 

I am wondering if someone could please help me with an issue I am currently 
trying to solve:

I have a "static" code which looks as follows:

tsd_res_fra_08 =res_fra_08['D_Cummulative'][100]
tsd_res_fra_09 =res_fra_09['D_Cummulative'][100]
tsd_res_fra_10 =res_fra_10['D_Cummulative'][100]
tsd_res_fra_11 =res_fra_11['D_Cummulative'][100]
tsd_res_fra_12 =res_fra_12['D_Cummulative'][100]
tsd_res_fra_13 =res_fra_13['D_Cummulative'][100]
tsd_res_fra_14 =res_fra_14['D_Cummulative'][100]
tsd_res_fra_15 =res_fra_15['D_Cummulative'][100]
reg_list_fra = 
list([tsd_res_fra_08,tsd_res_fra_09,tsd_res_fra_10,tsd_res_fra_11,tsd_res_fra_12,tsd_res_fra_13,tsd_res_fra_14,tsd_res_fra_15])

fra_gdp = fra_gdpseries.tolist()

import statsmodels.api as sm
X = reg_list_fra
y = fra_gdp 
X = sm.add_constant(X)
model = sm.OLS(y, X).fit()
predictions = model.predict(X)
model.rsquared_adj

Now I would like to generate a "dynamic" code by replacing 100 in the top eight 
rows to i and let it run from 1 to 1000, thereby running the regression below 
for every i and save its rsquared_adjvalue in a new list, which contains the 
rsquared_adj values for i=1, i=2,... i=1000. y stays "static" the whole time.

Can someone please help me here?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Regex for changing :variable to ${variable} in sql query

2018-04-18 Thread MRAB

On 2018-04-18 08:25, zljubi...@gmail.com wrote:

Hi,

I have a sql query in which all variables declared as :variable should be 
changed to ${variable}.

for example this sql:

select *
from table
where ":x" = "1" and :y=2
and   field in (:string)
and   time between :from and  :to


should be translated to:

select *
from table
where "${x}" = "1" and ${y} = 2
and   field in ( ${string} )
and   time between ${from} and ${to}

As far as I have come is to find the group as (:(.+?)\b)
and than replace it as ${$2}

(it would be nice if before and after the ${variable} it is always one space)

For opposite change (from ${variable} notation to :variable) I am using:

sql.replace('${', ':').replace('}', '')

Can someone please help?


Try this:

new_query = re.sub(r':([a-z][a-z0-9_]*)', r'${\1}', query)

To convert the other way, try this:

new_query = re.sub(r'\$\{([a-z][a-z0-9_]*)\}', r':\1', query)
--
https://mail.python.org/mailman/listinfo/python-list


unittest.Testsuite and execution order

2018-04-18 Thread Francesco Russo
Hello!

I'm reading the documentation of unittest.TestSuite (Python 2 and 3), but I
can't find any explicit sentence stating that TestSuite will honor the
order. I can only read that TestSuite can group test cases together. Please
blame it on my poor English skills if I'm not interpreting the
documentation correctly.

My use case: my SUT is split into modules. Besides writing unit tests for
each module, I want to write an integration test, and I also need to
perform some actions between two calls to the SUT. In my case, the order of
the execution is important.

Now, the current implementation of TestSuite uses a list, internally, so,
today, the order is honored if I create a TestSuite calling addTest() in
the proper order, or if I pass a list to the constructor. I've seen
examples like this:

class MyTestCode(unittest.TestCase):
   def test_func_1(self):
  # do something to test func_1 on the SUT
  sut.func_1()
  self.assert(...)

   def perform_intermediate_step(self):
  # do something between func_1 and func_2

   def test_func_2(self):
  # do something to test func_2 on the SUT
  sut.func_2()
  self.assert(...)

suite = unittest.TestSuite()
suite.addTest(MyTestCode("test_func_1"))
suite.addTest(MyTestCode("perform_intermediate_step"))
suite.addTest(MyTestCode("test_func_2"))

Such an example works, today, since TestSuite uses a list, and addTest()
appends to the list.
My question is: is this something that I can rely on for the future? I
definitely don't want to rely on the current implementation, unless I see
it in the documentation.

If it's something that I can't rely on for the future, then I'd rather
write my test code in a different way.

Regards,
Francesco

P.S.: I strongly believe that there are better ways to implement a test
like the one I just described, but what I'm interested in now is whether
TestSuite is meant to be future-proof for such a case.

-- 
Francesco Russo
The White Rabbit put on his spectacles. 'Where shall I begin, please your
Majesty?' he asked.
'Begin at the beginning,' the King said gravely, 'and go on till you come
to the end: then stop.'
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: unittest.Testsuite and execution order

2018-04-18 Thread Chris Angelico
On Thu, Apr 19, 2018 at 2:51 AM, Francesco Russo  wrote:
> My use case: my SUT is split into modules. Besides writing unit tests for
> each module, I want to write an integration test, and I also need to
> perform some actions between two calls to the SUT. In my case, the order of
> the execution is important.

In that case, make these tests into a single test. If you have to do
the steps together to correctly test it, they're not separate tests,
they're separate parts of the same test.

> class MyTestCode(unittest.TestCase):
>def test_func_1(self):
>   # do something to test func_1 on the SUT
>   sut.func_1()
>   self.assert(...)
>
>def perform_intermediate_step(self):
>   # do something between func_1 and func_2
>
>def test_func_2(self):
>   # do something to test func_2 on the SUT
>   sut.func_2()
>   self.assert(...)

This is a bad idea. Each function that starts test_ should be
completely independent. You should be able to run any one of them on
its own (say, if you're trying to figure out why your latest change
caused a test failure), and it should have the same result.

Make it so that test_func_1 and test_func_2 are completely
independent, and then, if you need a single test that uses both, have
a test that calls on each function.

> Such an example works, today, since TestSuite uses a list, and addTest()
> appends to the list.
> My question is: is this something that I can rely on for the future? I
> definitely don't want to rely on the current implementation, unless I see
> it in the documentation.

I would say no, you can't rely on it. If you can't find it in the
docs, don't assume it's true. Test order randomization can be
controlled with a simple command line flag.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


RE newbie question

2018-04-18 Thread TUA
import re

compval = 'A123456_8'
regex = '[a-zA-Z]\w{0,7}'

if re.match(regex, compval):
   print('Yes')
else:
   print('No')  


My intention is to implement a max. length of 8 for an input string. The above 
works well in all other respects, but does allow for strings that are too long.

What is the proper way to fix this?

Thanks for any help!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: RE newbie question

2018-04-18 Thread Rob Gaddi

On 04/18/2018 12:37 PM, TUA wrote:

import re

compval = 'A123456_8'
regex = '[a-zA-Z]\w{0,7}'

if re.match(regex, compval):
print('Yes')
else:
print('No')


My intention is to implement a max. length of 8 for an input string. The above 
works well in all other respects, but does allow for strings that are too long.

What is the proper way to fix this?

Thanks for any help!



You could put the end marker $ on your regex so that it won't match if 
it's not the end.


Or, you know, you could just check len(compval) <= 8 and not get bogged 
down in regexes.  They tend to be excellent solutions to only a very 
specific complexity of problem.


--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Regex for changing :variable to ${variable} in sql query

2018-04-18 Thread zljubisic
On Wednesday, 18 April 2018 19:34:37 UTC+2, MRAB  wrote:
> > Hi,
> > 
> > I have a sql query in which all variables declared as :variable should be 
> > changed to ${variable}.
> > 
> > for example this sql:
> > 
> > select *
> > from table
> > where ":x" = "1" and :y=2
> > and   field in (:string)
> > and   time between :from and  :to
> > 
> > 
> > should be translated to:
> > 
> > select *
> > from table
> > where "${x}" = "1" and ${y} = 2
> > and   field in ( ${string} )
> > and   time between ${from} and ${to}
> > 
> > As far as I have come is to find the group as (:(.+?)\b)
> > and than replace it as ${$2}
> > 
> > (it would be nice if before and after the ${variable} it is always one 
> > space)
> > 
> > For opposite change (from ${variable} notation to :variable) I am using:
> > 
> > sql.replace('${', ':').replace('}', '')
> > 
> > Can someone please help?
> > 
> Try this:
> 
> new_query = re.sub(r':([a-z][a-z0-9_]*)', r'${\1}', query)
> 
> To convert the other way, try this:
> 
> new_query = re.sub(r'\$\{([a-z][a-z0-9_]*)\}', r':\1', query)

Thanks a lot.
Regards.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: RE newbie question

2018-04-18 Thread Ian Kelly
On Wed, Apr 18, 2018 at 1:57 PM, Rob Gaddi
 wrote:
> On 04/18/2018 12:37 PM, TUA wrote:
>>
>> import re
>>
>> compval = 'A123456_8'
>> regex = '[a-zA-Z]\w{0,7}'
>>
>> if re.match(regex, compval):
>> print('Yes')
>> else:
>> print('No')
>>
>>
>> My intention is to implement a max. length of 8 for an input string. The
>> above works well in all other respects, but does allow for strings that are
>> too long.
>>
>> What is the proper way to fix this?
>>
>> Thanks for any help!
>>
>
> You could put the end marker $ on your regex so that it won't match if it's
> not the end.
>
> Or, you know, you could just check len(compval) <= 8 and not get bogged down
> in regexes.  They tend to be excellent solutions to only a very specific
> complexity of problem.

In Python 3.4+ you can also use re.fullmatch which requires a match
against the entire string.
-- 
https://mail.python.org/mailman/listinfo/python-list


python 3 creating hard links on ntfs

2018-04-18 Thread zljubisic
Is it possible to create hard links on windows with ntfs?
On linux I can use os.link, but how about windows?

Regards.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: RE newbie question

2018-04-18 Thread TUA
Thanks much!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: RE newbie question

2018-04-18 Thread Albert-Jan Roskam

On Apr 18, 2018 21:42, TUA  wrote:
>
> import re
>
> compval = 'A123456_8'
> regex = '[a-zA-Z]\w{0,7}'
>
> if re.match(regex, compval):
>print('Yes')
> else:
>print('No')
>
>
> My intention is to implement a max. length of 8 for an input string. The 
> above works well in all other respects, but does allow for strings that are 
> too long.
>
> What is the proper way to fix this?

Use a $ sign at the end of the regex
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: RE newbie question

2018-04-18 Thread Steven D'Aprano
On Wed, 18 Apr 2018 12:37:29 -0700, TUA wrote:

> My intention is to implement a max. length of 8 for an input string. The
> above works well in all other respects, but does allow for strings that
> are too long.

if len(input_string) > 8:
raise ValueError('string is too long')



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python 3 creating hard links on ntfs

2018-04-18 Thread Steven D'Aprano
On Wed, 18 Apr 2018 13:06:37 -0700, zljubisic wrote:

> Is it possible to create hard links on windows with ntfs? On linux I can
> use os.link, but how about windows?

According to the documentation, creating hard links on Windows has worked 
since version 3.2:

https://docs.python.org/3/library/os.html#os.link



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python 3 creating hard links on ntfs

2018-04-18 Thread eryk sun
On Wed, Apr 18, 2018 at 8:06 PM,   wrote:
> Is it possible to create hard links on windows with ntfs?
> On linux I can use os.link, but how about windows?

Windows support was added for os.link years ago in version 3.2.
Internally it's implemented via WinAPI CreateHardLink, which in turn
calls NTAPI NtSetInformationFile to to set the FileLinkInformation.
The only Microsoft filesystem that implements hard links is NTFS, and
it's implemented for files only, not directories. Non-Microsoft
file-system drivers may also implement it, e.g. a driver that allows
mounting ext2 or ext3 filesystems.

Percival linked an old topic that has ctypes code to call
CreateHardLinkA. Do not use that code. It's dangerously sloppy
crash-bait and unreliable with how Python 2 ctypes creates the call
stack for 64-bit Windows. Do imports, DLL loading, type definitions,
and function prototyping (i.e. errcheck, restype, argtypes) one time
only, at module or class scope. Use `kernel32 = WinDLL('kernel32',
use_last_error=True)` instead of windll.kernel32. Use Windows typedefs
from the ctypes.wintypes module. Use None for a NULL pointer, not 0.
If a WinAPI function fails, use ctypes.get_last_error() to get the
error code, and raise a useful exception via `raise
ctypes.WinError(error_code)`. Always use Unicode, especially for
file-system functions, e.g. call CreateHardlinkW, not CreateHardLinkA.
The [A]NSI function wrappers were added in the 1990s for compatibility
with Windows 9x systems, which didn't have Unicode support. That era
is ancient history.
-- 
https://mail.python.org/mailman/listinfo/python-list


The basics of the logging module mystify me

2018-04-18 Thread Skip Montanaro
This session is from Python 3.6.5 on Linux:

>>> import logging
>>> log = logging.getLogger()
>>> log.level
30
>>> logging.WARN
30
>>> log.warn("Awk! Goodbye...")
Awk! Goodbye...
>>> log.level = logging.INFO
>>> log.info("Awk! Goodbye...")
>>> log.level
20
>>> log.level == logging.INFO
True
>>> log.setLevel(logging.INFO)
>>> log.info("Awk! Goodbye...")
>>> log.isEnabledFor(logging.INFO)
True

Why do the two log.info(...) calls not produce output on stderr when
the level has clearly been set to logging.INFO? There is an active
stream handler as demonstrated by the successful log.warn(...) call.

I really don't like the logging module, but it looks like I'm stuck
with it. Why aren't simple/obvious things either simple or obvious?

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


best parallelisation strategy on python

2018-04-18 Thread simona bellavista
I have a code fortran 90 that is parallelised with MPI. I would like to 
traslate it in python, but I am not sure on the parallelisation strategy and 
libraries. I work on clusters, with each node with 5GB memory and 12 processors 
or 24 processors (depending on the cluster I am using). Ideally I would like to 
split the computation on several nodes.

Let me explain what this code does: It read ~100GB data, they are divided in 
hdf5 files of ~25GB each. The code should read the data, go through it and then 
select a fraction of the data, ~1GB and then some CPU intensive work on it, and 
repeat this process many times, say 1000 times, then write the results to a 
single final file.

I was thinking that the CPU intensive part would be written as a shared object 
in C.

Do you have suggestions about which library to use?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The basics of the logging module mystify me

2018-04-18 Thread Chris Angelico
On Thu, Apr 19, 2018 at 11:00 AM, Skip Montanaro
 wrote:
> This session is from Python 3.6.5 on Linux:
>
 import logging
 log = logging.getLogger()
 log.level
> 30
 logging.WARN
> 30
 log.warn("Awk! Goodbye...")
> Awk! Goodbye...
 log.level = logging.INFO
 log.info("Awk! Goodbye...")
 log.level
> 20
 log.level == logging.INFO
> True
 log.setLevel(logging.INFO)
 log.info("Awk! Goodbye...")
 log.isEnabledFor(logging.INFO)
> True
>
> Why do the two log.info(...) calls not produce output on stderr when
> the level has clearly been set to logging.INFO? There is an active
> stream handler as demonstrated by the successful log.warn(...) call.
>
> I really don't like the logging module, but it looks like I'm stuck
> with it. Why aren't simple/obvious things either simple or obvious?

I've no idea what setting log.level does; I would normally use
logging.basicConfig to set that sort of thing.

logging.basicConfig(level=logging.INFO)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list