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
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
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
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
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
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
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
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
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
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)
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
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
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
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
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
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,
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
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
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
So it is. Great!
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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
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
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
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
--
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 =
figured it out...
os.environ[QUERY_STRING] = foo=bar
fs = cgi.FieldStorage()
functionToBeTested(fs)
--
http://mail.python.org/mailman/listinfo/python-list
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
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
import threading
import logging
##
class Reader(threading.Thread):
def __init__(self, clientsock):
threading.Thread.__init__(self)
self.logger = logging.getLogger(Reader)
http://www.python.org/doc/2.4.1/inst/search-path.html#SECTION00041
--
http://mail.python.org/mailman/listinfo/python-list
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
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
Check out sitecustomize.py.
http://diveintopython.org/xml_processing/unicode.html
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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 =
could it be the umask?
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
-
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
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
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
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
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
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
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
my OS is Win2K (server, I think) if that makes any difference.
--
http://mail.python.org/mailman/listinfo/python-list
Thursday, 7PM
Harvard Science Center
1 Oxford St Room 507
Cambridge, mA 02101
'Nuff said.
--
http://mail.python.org/mailman/listinfo/python-list
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
--
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
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
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 =
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()
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
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.
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
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?
--
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
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
65 matches
Mail list logo