[issue18620] multiprocessing page leaves out important part of Pool example

2013-08-01 Thread Chris Curvey
New submission from Chris Curvey: on http://docs.python.org/2/library/multiprocessing.html, there is a bit about how to use a Pool properly, which looks like this pool = Pool(processes=4) # start 4 worker processes result = pool.apply_async(f, [10]) What this neglects to mention

c-based version of pyPdf?

2012-05-03 Thread Chris Curvey
I'm a long-time user of the pyPdf library, but now I'm having to work with bigger volumes -- larger PDFs and thousands of them at a shot. So performance is starting to become a problem. Does anyone know of an analogue to pyPdf that is faster? (Maybe something based on C with Python

subprocess.check_call() fails ... but only on my production machine

2010-10-12 Thread Chris Curvey
I've got a python program running on windows that executes a command- line script. The command being executed is: print cmd C:\Program Files\ImageMagick-6.6.1-Q16\convert.exe -density 72x72 c: \temp\choicepoint 2010-01 Stmt_p1.pdf -quiet -region (612.0x70.0+0+0 - blur 0x3) -region

Re: subprocess.check_call() fails ... but only on my production machine

2010-10-12 Thread Chris Curvey
just a note that the Windows 2007 Server is actually a Windows 2008 Server (despite the fact that Control Panel-System tells me it's 2007...but that's a different discussion) -- http://mail.python.org/mailman/listinfo/python-list

sorting ascending/descending with operator.attrgetter

2010-03-31 Thread Chris Curvey
I must be having a brain cramp. Given a list of objects, how can I sort the list on one attribute in descending order, then sort within each group in ascending order on another attribute. For example: class Foo: def __init__(self, a, b, c): self.a = a self.b = b

find text location (in pixels) using python (pyPdf)

2010-03-09 Thread Chris Curvey
Has anyone ever tried to find the pixel (or point) location of text in a PDF using Python? I've been using the pyPdf libraries for other things, and it seems to me that if I can find the bounding box for text, I should be able to calculate the location. What I want to do is take a PDF of one of

Re: PyPDF and print restrictions

2009-07-30 Thread Chris Curvey
On Jul 27, 4:16 pm, Chris Curvey ccur...@gmail.com wrote: Has anyone out there been able to enforce print restrictions on a PDF document by usingPyPDF? The documentation for encrypt states:  # @param user_pwd The user password, which allows for opening and reading  # the PDF file

PyPDF and print restrictions

2009-07-27 Thread Chris Curvey
Has anyone out there been able to enforce print restrictions on a PDF document by using PyPDF? The documentation for encrypt states: # @param user_pwd The user password, which allows for opening and reading # the PDF file with the restrictions provided. But there is no parameter for providing

Re: capture stdout and stderror from within a Windows Service?

2009-05-15 Thread Chris Curvey
On May 14, 11:57 am, Chris Curvey ccur...@gmail.com wrote: I'm trying to get this invocation right, and it is escaping me.  How can I capture the stdout and stderr if I launch a subprocess using subprocess.check_call()?  The twist here is that the call is running from within a Windows service

capture stdout and stderror from within a Windows Service?

2009-05-14 Thread Chris Curvey
I'm trying to get this invocation right, and it is escaping me. How can I capture the stdout and stderr if I launch a subprocess using subprocess.check_call()? The twist here is that the call is running from within a Windows service. I've tried: check_call(mycmd.exe, stdout=subprocess.PIPE)

Re: how to make a python windows service know it's own identity

2007-02-01 Thread Chris Curvey
On Feb 1, 2:10 pm, Larry Bates [EMAIL PROTECTED] wrote: Chris Curvey wrote: Hi all, I have used the win32com libraries to set up a service called MyService under Windows. So far, so good. Now I need to run multiple copies of the service on the same machine. I also have that working

how to make a python windows service know it's own identity

2007-01-31 Thread Chris Curvey
Hi all, I have used the win32com libraries to set up a service called MyService under Windows. So far, so good. Now I need to run multiple copies of the service on the same machine. I also have that working. For monitoring and logging, I'd like each instance of the service to know it's own

ISAPI filter

2006-12-04 Thread Chris Curvey
Hi all, I'm trying to write an ISAPI filter in Python, using the examples that come in the isapi directory of the win32com package. The installation program itself runs fine, but when I examine the properties of my web server, my filter has a big red down arrow next to it. But I can't seem to

ensuring valid latin-1

2006-11-29 Thread Chris Curvey
Hey all, I'm trying to write something that will fail fast if one of my users gives me non-latin-1 characters. So I tried this: testString = \x80 foo = unicode(testString, latin-1) foo u'\x80' I would have thought that that should have raised an error, because \x80 is not a valid character

makepy, ADO and dynamic.py

2006-09-09 Thread Chris Curvey
I'm trying to track down a performance issue in my Windows code, and hotshot is telling me that the most time and calls are spent in these methods ncalls tottime percall cumtime percall filename:lineno(function) 75975 63982.7790.842 124464.4191.638

2.4.3, unittest and socket logging

2006-08-17 Thread Chris Curvey
Hi all, I just upgraded to 2.4.3 (from 2.4.1) on Windows. Now each time I run my unit tests, they always throw this error at the end of the test run: Error in atexit._run_exitfuncs: Traceback (most recent call last): File c:\python24\lib\atexit.py, line 24, in _run_exitfuncs func(*targs,

shared logs and multiple configurations

2006-06-08 Thread Chris Curvey
Hi all, I've apparently tied myself up a bit using the logging package. In my project, I have a core set of model and controller classes that set up their logging using logging.fileConfig(). So far, so good. But I use these core classes from a bunch of different places. Sometimes from within a

example of logging w/ user-defined keywords?

2006-04-12 Thread Chris Curvey
Several things that I've read lead me to think this is possible, but I can't figure out how to do it. I have some information (a job number) that I would like logged on every log message, just like the time or the severity. I saw some mail threads that suggested that there was an easy way to do

warning users of problems with logging

2006-04-04 Thread Chris Curvey
The following code exists in logging/config.py handlers[hand] = h except: #if an error occurs when instantiating a handler, too bad pass#this could happen e.g. because of lack of privileges The problem here is that if something did go wrong instantiating the handler, you have no

Re: warning users of problems with logging

2006-04-04 Thread Chris Curvey
So it is. Great! -- http://mail.python.org/mailman/listinfo/python-list

Re: socket.ssl with key files?

2006-01-19 Thread Chris Curvey
thanks for the info. 1) Am I correct that I should just be splitting the files? 2) The passphrase question was in the back of my mind, but I guess I need to move it to the front. Hopefully someone here will have an idea. (I wonder if M2Crypto handles that?) I guess it's better to know that the

Re: socket.ssl with key files?

2006-01-19 Thread Chris Curvey
Rats, you beat me to it. It seems to work if I just give the same, combined file as the argument to both the key_file and cert_file parameters. (that's not to say that it doesn't work if I do something else). In my case, the passphrase is packaged up in the xml payload and sent over. Thank you

socket.ssl with key files?

2006-01-18 Thread Chris Curvey
I need to use socket.ssl() to open a connection using key files. I have been provided with a text file called cert_key_pem.txt containing my keys that looks like this: -BEGIN RSA PRIVATE KEY- MIICXgIBAAKBgQDKwLuk/UpICOnZvH3mf9rFQvCkDPA8XQZLpa80Z0liMVYu4GQT snip -END RSA PRIVATE

paypal SOAP API from ZSI or SOAPpy?

2006-01-13 Thread Chris Curvey
Anyone had any luck with this? (Or can anyone just warn me off it right now?) I'm trying to just set up the service proxy via WSDL, and I'm getting either a runaway process that's chewing up tons of memory or a very quick stack trace. I've tried both ZSI and SOAPpy (both stable and release

Re: importing a method

2005-11-27 Thread Chris Curvey
why not just have your user subclass soandso and override the definition of custom? from soandso import soandso class MyClass(soandso): def custom(self): self.theother = 3 c = MyClass() -- http://mail.python.org/mailman/listinfo/python-list

Re: mxODBC sql MSAccess

2005-11-21 Thread Chris Curvey
mxODBC implements the Python DB-API spec, which states that each row of query results is returned as a tuple. If you want the data displayed differently, you can do it yourself. for row in rows: print \t.join(row) should do it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tricky Areas in Python

2005-10-23 Thread Chris Curvey
I usually start by asking how you make variables private within classes. That seems to tell me if they understand something about the design of the language and it's a quick filter to tell if they know something about the syntax. The other question that I use is asking about 3rd party libraries

Re: 1 Million users.. I can't Scale!!

2005-09-28 Thread Chris Curvey
I guess I'd look at each part of the system independently to be sure I'm finding the real bottleneck. (It may be Python, it may not). Under your current system, is your python program still trying to send messages after 5 seconds? 30 seconds, 300 seconds? (Or have the messages been delivered

Re: send mail through webmail

2005-09-21 Thread Chris Curvey
If you have to do it thru the web, I would use one of the browser packages (mechanize, mechanoid, PAMIE, or IshyBrowser). Then you can scrape the site, fill out the forms, press the buttons, etc. This will be a *lot* more painful than using SMTP --

brain cramp: emulating cgi.FieldStorage

2005-09-15 Thread Chris Curvey
I can't be the first person to want to do this, but I also can't seem to find a solution. (Perhaps my Google skills are poor today.) How can I emulate cgi.FieldStorage() for my unit tests so that I don't have to put a web server in the way? what I'd like to do is something like fs =

Re: brain cramp: emulating cgi.FieldStorage

2005-09-15 Thread Chris Curvey
figured it out... os.environ[QUERY_STRING] = foo=bar fs = cgi.FieldStorage() functionToBeTested(fs) -- http://mail.python.org/mailman/listinfo/python-list

job scheduling framework?

2005-09-08 Thread Chris Curvey
Has anyone seen a simple open source job-scheduling framework written in Python? I don't really want to reinvent the wheel. All I need is the ability to set up a series of atomic jobs as a stream, then have the system execute the jobs in the stream one-at-a-time until all the jobs in the stream

__del__ pattern?

2005-08-15 Thread Chris Curvey
I need to ensure that there is only one instance of my python class on my machine at a given time. (Not within an interpreter -- that would just be a singleton -- but on the machine.) These instances are created and destroyed, but there can be only one at a time. So when my class is

Re: client server question

2005-08-11 Thread Chris Curvey
import threading import logging ## class Reader(threading.Thread): def __init__(self, clientsock): threading.Thread.__init__(self) self.logger = logging.getLogger(Reader)

Re: Python Path Setting

2005-07-21 Thread Chris Curvey
http://www.python.org/doc/2.4.1/inst/search-path.html#SECTION00041 -- http://mail.python.org/mailman/listinfo/python-list

Re: login website that using PHP

2005-06-20 Thread Chris Curvey
I'll add a plug for PAMIE (another set of Python classes that drive IE) http://pamie.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: separate IE instances?

2005-06-13 Thread Chris Curvey
the good news is that if run the ShellExecute bit twice, I get two instances of explorer in Task Manager The bad news is that the line ioObj = hwnds[1] tells me either This object does not support enumeration (if I have not used makepy to generate the classes) or object has no attribute

Re: How to use 8bit character sets?

2005-06-12 Thread Chris Curvey
Check out sitecustomize.py. http://diveintopython.org/xml_processing/unicode.html -- http://mail.python.org/mailman/listinfo/python-list

Re: separate IE instances?

2005-06-07 Thread Chris Curvey
thanks for all the help. I'll give the ShellExecute() approach a try in the morning. The short version of what I'm trying to do is Have my website login to a 3rd party website on behalf of my customer, fill out a form, and submit it. I'm just using CGI to keep things simple, but

Re: help with sending mail in Program

2005-06-06 Thread Chris Curvey
Maybe you could give us a little more info about where you're getting messed up. The message body is just a string, so if you can build a string out of variables, you should be able to do it. -- http://mail.python.org/mailman/listinfo/python-list

separate IE instances?

2005-06-06 Thread Chris Curvey
I need to create a set of IE instances that have different sets of session cookies. I thought that using the win32com.DispatchEx function would do this, but it doesn't seem to. In other words ie1 = win32com.DispatchEx(InternetExplorer.Application) ie2 =

Re: weird cgi problem w/ apache

2005-06-04 Thread Chris Curvey
could it be the umask? -- http://mail.python.org/mailman/listinfo/python-list

win32com and apache and permissions

2005-05-14 Thread Chris Curvey
I'm trying to have a Python script (which is being launched by Apache as a CGI) control Internet Explorer. I have this working on my development box, but when I moved the code to my integration test box, I get Access Denied when trying to launch IE. This only seems to happen when running Apache

Re: win32com and apache and permissions

2005-05-14 Thread Chris Curvey
found the answer five minutes after posting the question. Isn't that always the way? I had not granted the Apache user permission to launch IE. To do so: * launch DCOMCNFG.exe * choose internet explorer and click properties * choose the security tab and and custom launch permissions * edit

CGIHTTPServer on Windows?

2005-05-11 Thread Chris Curvey
Hi all, I'm trying to work around my cgi-driving-IE problem by creating my own server, but CGIHTTPServer on Windows (python 2.3.5) seems to be having troubles. Trying to run a hello world CGI gives me: COMPAQ.ANTIQUES - - [11/May/2005 07:18:50] GET /cgi-bin/hello.py HTTP/1.1 200 -

FutureWarning in win32com?

2005-05-11 Thread Chris Curvey
Hi all, When trying to automate IE thru win32com (using PAMIE), I'm getting this message out C:\Program Files\Plone 2\Python\lib\site-packages\win32com\client\dynamic.py:463 : FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Pyth on 2.4 and up debug_attr_print(Getting

win32com and ADO

2005-05-11 Thread Chris Curvey
I'm having one of those weeks. I have this pattern all over my code. result = conn.execute(select * from foo) while not result.EOF: doSomething() result.MoveNext() So recently I got around to running makepy on all of the Microsoft ActiveX Data Objects, and now every call to that

Re: win32com and ADO

2005-05-11 Thread Chris Curvey
Thanks Peter. I found the files that makepy generated (in $PYTHON_HOME/Lib/site-packages/win32com/gen_py). I've tried deleting the individual files, and the entire directory, and I'm still getting the error. (Maybe something was changed in the registry?) [Fun side note -- after deleting the

Re: win32com and ADO

2005-05-11 Thread Chris Curvey
Achim, Bingo. The recordset is in item 0. And that appears to work even on systems where makepy has not been run. Thanks so much. -- http://mail.python.org/mailman/listinfo/python-list

Re: win32com and ADO

2005-05-11 Thread Chris Curvey
it was working fine before running makepy, once I ran makepy, I had to add the array index to make it work. -- http://mail.python.org/mailman/listinfo/python-list

win32com Dispatch() and SetPriorityClass()

2005-05-11 Thread Chris Curvey
if I'm using Dispatch() to manage a COM object (IE), is there a way to get ahold of the process handle so that I can bump it's priority? -- http://mail.python.org/mailman/listinfo/python-list

win32com and IIS

2005-05-10 Thread Chris Curvey
Hi all, I have a python script that uses the PAMIE libraries to drive IE. It runs fine from the command line, but it appears to have some permissions problem when I run it via CGI. Here's the stack trace that I'm getting. File c:\documents and settings\chris\my

Re: win32com and IIS

2005-05-10 Thread Chris Curvey
my OS is Win2K (server, I think) if that makes any difference. -- http://mail.python.org/mailman/listinfo/python-list

ANN: Boston Python Interest Group Meeting

2005-05-09 Thread Chris Curvey
Thursday, 7PM Harvard Science Center 1 Oxford St Room 507 Cambridge, mA 02101 'Nuff said. -- http://mail.python.org/mailman/listinfo/python-list

Re: include apythonscript.py

2005-05-09 Thread Chris Curvey
the PHP include doesn't have an exact match in Python, but I think you can do what you intend. To follow the first example from php.net, this would work vars.py color = 'green' fruit = 'apple' test.py from vars import * print A , color, fruit HTH --

Re: xmlrpclib and decoding entity references

2005-05-04 Thread Chris Curvey
yep, I'm using SimpleRPCServer, but something is getting messed up between the receipt of the XML stream and the delivery to my function. The normal entity references (like lt; and amp;) are handled OK, but the character references are not working. For instance, Andr#xe9; is received by the

Re: xmlrpclib and decoding entity references

2005-05-04 Thread Chris Curvey
Here is the solution. Incidentally, the client is Cold Fusion. import re import logging import logging.config import os import SimpleXMLRPCServer logging.config.fileConfig(logging.ini) class

Re: anybody have a CGIXMLRPCRequestHandler example?

2005-05-02 Thread Chris Curvey
here's the simple example, for posterity import os import SimpleXMLRPCServer class Foo: def settings(self): return os.environ def echo(self, something): return something def greeting(self, name): return hello, + name handler =

xmlrpc server running behind IIS as a CGI

2005-05-02 Thread Chris Curvey
Here's my server: import os import SimpleXMLRPCServer class Foo: def settings(self): return os.environ def echo(self, something): return something def greeting(self, name): return hello, + name handler = SimpleXMLRPCServer.CGIXMLRPCRequestHandler()

Re: modes for AES encryption?

2005-03-29 Thread Chris Curvey
Chris Curvey wrote: I'm trying to use the AES module in the Python Cryptography Toolkit. I need to set the mode to ECB/NoPadding, and there's a reference to a Mode parameter in the new() function, but no examples for AES. Who can point me in the right direction? Answering my own question

cgi and multipart/form-data?

2005-03-29 Thread Chris Curvey
I have a form like this: form method=post enctype=multipart/form-data input type=file name=myFile input type=text name=foo input type=submit /form When I submit this form to my Python script using the CGI module, I seem to get the myFile variable, but I don't seem to the foo variable.

Re: cgi and multipart/form-data?

2005-03-29 Thread Chris Curvey
Chris Curvey wrote: I have a form like this: form method=post enctype=multipart/form-data input type=file name=myFile input type=text name=foo input type=submit /form When I submit this form to my Python script using the CGI module, I seem to get the myFile variable, but I don't seem

modes for AES encryption?

2005-03-24 Thread Chris Curvey
I'm trying to use the AES module in the Python Cryptography Toolkit. I need to set the mode to ECB/NoPadding, and there's a reference to a Mode parameter in the new() function, but no examples for AES. Who can point me in the right direction? --

python reading excel thru ADO ?

2005-03-14 Thread Chris Curvey
Windows-specific question for you all... I've been reading http://www.mayukhbose.com/python/ado/ad-connection.php , which seems to infer that I can read an Excel file using the ADO interface with Python on Windows. Unfortunately, the usual problem with ADO -- connection strings -- is raising

Re: python reading excel thru ADO ?

2005-03-14 Thread Chris Curvey
Chris Curvey wrote: Windows-specific question for you all... I've been reading http://www.mayukhbose.com/python/ado/ad-connection.php , which seems to infer that I can read an Excel file using the ADO interface with Python on Windows. Unfortunately, the usual problem with ADO -- connection