Re: Dowloading package dependencies from locked down machine

2020-07-27 Thread Andrew McLean
On 26/07/2020 14:07, Mike Dewhirst wrote: I think your best bet is to make a formal business case to your IT people and explain what's in it for them. If they hold all the cards you defeat them at your peril. The issue is that the IT department thinks that installing the full power of Python

Dowloading package dependencies from locked down machine

2020-07-26 Thread Andrew McLean
At work my only Internet access is via a locked-down PC. The IT department are not willing to install Python on it [1]. Ideally I would download packages and their dependencies from PyPi using "pip download" at the command line. Any better solutions than downloading the package in a browser, fi

Nesting concurrent.futures.ThreadPoolExecutor

2017-07-20 Thread Andrew McLean
I have a program where I am currently using a concurrent.futures.ThreadPoolExecutor to run multiple tasks concurrently. These tasks are typically I/O bound, involving access to local databases and remote REST APIs. However, these tasks could themselves be split into subtasks, which would also b

Re: Real-world use of concurrent.futures

2014-05-13 Thread Andrew McLean
On 08/05/2014 21:44, Ian Kelly wrote: > On May 8, 2014 12:57 PM, "Andrew McLean" <mailto:li...@andros.org.uk>> wrote: > > So far so good. However, I thought this would be an opportunity to > > explore concurrent.futures and to see whether it offered any b

Re: Real-world use of concurrent.futures

2014-05-08 Thread Andrew McLean
On 08/05/2014 21:44, Ian Kelly wrote: > I don't think it needs to be "messy". Something like this should do > the trick, I think: > > from concurrent.futures import * > from itertools import islice > > def batched_pool_runner(f, iterable, pool, batch_size): > it = iter(iterable) > # Submit the

Re: Real-world use of concurrent.futures

2014-05-08 Thread Andrew McLean
On 08/05/2014 20:06, Chris Angelico wrote: > On Fri, May 9, 2014 at 4:55 AM, Andrew McLean wrote: >> Because of latency in the DNS lookup this could >> benefit from multithreading. > Before you go too far down roads that are starting to look > problematic: A DNS lookup is a

Real-world use of concurrent.futures

2014-05-08 Thread Andrew McLean
I have a problem that would benefit from a multithreaded implementation and having trouble understanding how to approach it using concurrent.futures. The details don't really matter, but it will probably help to be explicit. I have a large CSV file that contains a lot of fields, amongst them one c

Re: CSV writer question

2011-10-24 Thread Andrew McLean
On 24/10/2011 08:03, Chris Angelico wrote: On Mon, Oct 24, 2011 at 4:18 PM, Jason Swails wrote: my_csv = csv.writer(open('temp.1.csv', 'wb')) Have you confirmed, or can you confirm, whether or not the file gets closed automatically when the writer gets destructed? If so, all you need to do is

Re: Python Tools for Visual Studio - anyone using it?

2011-08-31 Thread Andrew McLean
I understand that Python Tools for Visual Studio doesn't work with VS Express, but does work with the (free) VS 2010 Shell. Does anyone know if you can install VS Express and VS Shell on the same machine? -- http://mail.python.org/mailman/listinfo/python-list

Re: Instrumented web proxy

2008-03-28 Thread Andrew McLean
Paul Rubin wrote: > Andrew McLean <[EMAIL PROTECTED]> writes: >> I would like to write a web (http) proxy which I can instrument to >> automatically extract information from certain web sites as I browse >> them. Specifically, I would want to process URLs that match

Instrumented web proxy

2008-03-27 Thread Andrew McLean
I would like to write a web (http) proxy which I can instrument to automatically extract information from certain web sites as I browse them. Specifically, I would want to process URLs that match a particular regexp. For those URLs I would have code that parsed the content and logged some of it

Re: Getting some element from sets.Set

2007-05-07 Thread Andrew McLean
[EMAIL PROTECTED] wrote: > In the particular case, I have to read an attribute from any one of > the elements, which one doesn't matter because this attribute value is > same across all elements in the set. Someone else pointed out that there might be better data structures. If performance was no

Measureing memory used by a subprocess

2007-04-01 Thread Andrew McLean
I want to script the benchmarking of some compression algorithms on a Windows box. The algorithms are all embodied in command line executables, such as gzip and bzip2. I would like to measure three things: 1. size of compressed file 2. elapsed time (clock or preferably CPU) 3. memory used The f

Re: Does Python have equivalent to MATLAB "varargin", "varargout", "nargin", "nargout"?

2007-02-18 Thread Andrew McLean
Where you would use varargin and nargin in Matlab, you would use the *args mechanism in Python. Try calling def t1(*args): print args print len(args) with different argument lists Where you would use varargout and nargout in Matlab you would use tuple unpacking in Python. Pla

Re: ZODB and Python 2.5

2006-10-21 Thread Andrew McLean
Robert Kern wrote: > I would suggest, in order: > > 1) Look on the relevant mailing list for people talking about using ZODB > with Python 2.5. Been there, didn't find anything. Except that recently released versions of Zope (2.9.5 and 2.10.0) aren't compatible with Python 2.5. [Being pedantic

ZODB and Python 2.5

2006-10-20 Thread Andrew McLean
I'm going to have to delay upgrading to Python 2.5 until all the libraries I use support it. One key library for me is ZODB. I've Googled and can't find any information on the developers' plans. Does anyone have any information that might help? - Andrew -- http://mail.python.org/mailman/list

Re: Converting MSWord Docs to PDF

2006-10-10 Thread Andrew McLean
Steve Holden wrote: > If that *isn't* satisfactory then a modest investment in Adobe > Acrobat/Distiller plus the use of Python's scripting facilities to > direct the conversion would be preferable to spending a huge amount of > time writing a hand-crafted solution. An alternative to Adobe Dist

Re: Unexpected behaviour of csv module

2006-09-26 Thread Andrew McLean
John Machin wrote: > You can fix that. The beauty of open source is that you can grab it > (Windows: c:\python2?\lib\csv.py (typically)) and hack it about till it > suits your needs. Go fer it! Unfortunately the bits I should change are in _csv.c and, as I'm not very proficient at C, that wouldn'

Re: Unexpected behaviour of csv module

2006-09-25 Thread Andrew McLean
John Machin wrote: > A better workaround IMHO is to strip each *field* after it is received > from the csv reader. In fact, it is very rare that leading or trailing > space in CSV fields is of any significance at all. Multiple spaces > ditto. Just do this all the time: > > row = [' '.join(x.split(

Unexpected behaviour of csv module

2006-09-24 Thread Andrew McLean
I have a bunch of csv files that have the following characteristics: - field delimiter is a comma - all fields quoted with double quotes - lines terminated by a *space* followed by a newline What surprised me was that the csv reader included the trailing space in the final field value returned,

Re: Are Python's reserved words reserved in places they dont need to be?

2006-09-14 Thread Andrew McLean
Roy Smith wrote: > > As I remember, you didn't need the whitespace either. IIRC, your example > above could have been written as: > > PROGRAMKWDS > REALREAL,WRITE > WRITE=1.0 > REAL=2.0 > WRITE(*,*)WRITE,REAL > END > It's stranger than that. FORTRAN 77 is in

Re: Algorithm Question

2006-09-14 Thread Andrew McLean
John Machin wrote: > A quick silly question: what is the problem that you are trying to > solve? A fair question :-) The problem may seem a bit strange, but here it is: I have the ability to query a database in a legacy system and extract records which match a particular pattern. Specifically,

Re: Algorithm Question

2006-09-11 Thread Andrew McLean
Carl Banks wrote: > Andrew McLean wrote: >> I have a list of strings, A. I want to find a set of strings B such that >> for any "a in A" there exists "b in B" such that b is a sub-string of a. > > B=A? > >> But I also want to minimise T = sum_j

Algorithm Question

2006-09-10 Thread Andrew McLean
This really an algorithm question more that a Python question, but it would be implemented in Python I have a list of strings, A. I want to find a set of strings B such that for any "a in A" there exists "b in B" such that b is a sub-string of a. But I also want to minimise T = sum_j t_j wh

Re: Linear regression in 3 dimensions

2006-09-08 Thread Andrew McLean
Bernhard, Levenberg-Marquardt is a good solution when you want to solve a general non-linear least-squares problem. As Robert said, the OPs problem is linear and Robert's solution exploits that. Using LM here is unnecessary and I suspect a fair bit less efficient (i.e. slower). - Andrew [EMA

Re: Looking for Python code to obsfucate mailto links on web site

2006-06-27 Thread Andrew McLean
Dan Sommers wrote: > On Sun, 25 Jun 2006 21:10:31 +0100, > Andrew McLean <[EMAIL PROTECTED]> wrote: > >> I'm looking at putting some e-mail contact addresses on a web site, >> and wanted to make it difficult for spammers to harvest them. > > [ ... ] > &g

Looking for Python code to obsfucate mailto links on web site

2006-06-25 Thread Andrew McLean
I'm looking at putting some e-mail contact addresses on a web site, and wanted to make it difficult for spammers to harvest them. I found some Python code that I can call within my application. http://www.zapyon.de/spam-me-not/ It works exactly as expected. However, I am concerned that the tech

Re: Python's CSV reader

2005-08-05 Thread Andrew McLean
ines, the first line being a header containing field names specific to that record with the second line containing the corresponding data. It would help of you let us know which (if any) was correct. -- Andrew McLean -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's CSV reader

2005-08-04 Thread Andrew McLean
ot; % (len(detail), detail) You could wrap this up into a class which returns (header, detail) pairs and does better error handling, but the above code should illustrate the basics. -- Andrew McLean -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style article with interesting section on white space

2005-01-30 Thread Andrew McLean
rage performance across different benchmarks of different Fortran compilers on the same platform can be as much a factor of two. Variation of individual benchmarks as much as a factor of three. Some of you might be surprised at how many different Fortran compilers are available! -- Andrew McLean --

Re: Fuzzy matching of postal addresses [1/1]

2005-01-23 Thread Andrew McLean
In article <[EMAIL PROTECTED]>, John Machin <[EMAIL PROTECTED]> writes Andrew McLean wrote: In case anyone is interested, here is the latest. def insCost(tokenList, indx, pos): """The cost of inserting a specific token at a specific normalised position al

Fuzzy matching of postal addresses [1/1]

2005-01-23 Thread Andrew McLean
okens into the dynamic programming method, but I think I got there! At least my test cases seem to work! # # First attempt at a fuzzy compare of two addresses using a form of Edit Distance algorithm on tokens # v0.5 # Andrew McLean, 23 January 2005 # # The main routine editDistance takes two lis

Re: Fuzzy matching of postal addresses

2005-01-18 Thread Andrew McLean
ns. Then work with a metric based on the differences between the sequences. The simple case would look at deleting tokens and perhaps concatenating tokens to make a match. -- Andrew McLean -- http://mail.python.org/mailman/listinfo/python-list

Fuzzy matching of postal addresses

2005-01-17 Thread Andrew McLean
DT8 3EL THE PRESBYTERY, SHORTMOOR, BEAMINSTER, DORSET DT8 3EL The Pinnacles, White Sheet Hill, BEAMINSTER, DORSET, DT8 3SF PINNACLES, WHITESHEET HILL, BEAMINSTER, DORSET DT8 3SF The challenge is to fix some of the false negatives above without introducing false positives! Any pointers gratef

Re: Driving win32 GUIs with Python

2004-12-19 Thread Andrew McLean
In article <[EMAIL PROTECTED]>, Fredrik Lundh <[EMAIL PROTECTED]> writes Andrew McLean wrote: I have a requirement to drive a Windows GUI program from a Python Script. The program was originally a DOS program written in Turbo Pascal, and was recently translated to Delphi. I do

Driving win32 GUIs with Python

2004-12-19 Thread Andrew McLean
ed, The "AutoIT Windows Spy" I found here: http://www.hiddensoft.com/AutoIt/ looks like it will be useful. Any pointers gratefully received. Regards, Andrew McLean -- http://mail.python.org/mailman/listinfo/python-list