including pygments code_block directive in rst2* from docutils

2010-06-10 Thread Sean Davis
I would like to simply extend the rst2* scripts bundled with docutils to include a code_block directive. I have found a number of sites that discuss the topic, but I guess I am new enough to docutils to still be wondering how to make it actually happen. I'm looking to convert a single .rst file t

Re: Detecting the first time I open/append to a file

2008-09-23 Thread Sean Davis
On Sep 23, 2:02 pm, [EMAIL PROTECTED] wrote: > I have a simulation that runs many times with different parameters, > and I want to aggregate the output into a  single file with one rub: I > want a header to be written only the first time. My program looks a > bit like this: > > def main(): >     fo

lxml and adding a stylesheet

2008-09-23 Thread Sean Davis
I have an xml document and simply need to add an xml-stylesheet to it. I am using lxml to parse the xml document and then would like to insert the xml-stylesheet tag using the etree api. Any suggestions? Thanks, Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: emulating read and readline methods

2008-09-11 Thread Sean Davis
On Sep 10, 7:54 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Sep 11, 8:01 am, MRAB <[EMAIL PROTECTED]> wrote: > > > > > On Sep 10, 6:59 pm, Sean Davis <[EMAIL PROTECTED]> wrote: > > > > I have a large file that I would like to transform and t

emulating read and readline methods

2008-09-10 Thread Sean Davis
I have a large file that I would like to transform and then feed to a function (psycopg2 copy_from) that expects a file-like object (needs read and readline methods). I have a class like so: class GeneInfo(): def __init__(self): #urllib.urlretrieve('ftp://ftp.ncbi.nih.gov/gene/DATA/ g

Re: running python as a dameon

2008-09-05 Thread Sean Davis
On Sep 5, 5:55 pm, peyman <[EMAIL PROTECTED]> wrote: > Hi > > I have a Natural Language Processing (NLP) code written in python that > reads into memory a large training file and then given a sentence tags > it, using the training data. I want to put this NLP code on a server > which handles all in

Importing module with name given as a variable

2008-08-30 Thread Sean Davis
What is the "best practice" for importing an arbitrary module given that the name is stored in a variable? The context is a simple web application with URL dispatching to a module and function. I know of __import__(), the imp module, and exec. For each of these, is there a way to make them work

Re: Numpy array to gzip file

2008-06-11 Thread Sean Davis
On Jun 11, 12:42 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jun 11, 9:17 am, Sean Davis <[EMAIL PROTECTED]> wrote: > > > > > I have a set of numpy arrays which I would like to save to a gzip > > file. Here is an example without gzip

Numpy array to gzip file

2008-06-11 Thread Sean Davis
I have a set of numpy arrays which I would like to save to a gzip file. Here is an example without gzip: b=numpy.ones(100,dtype=numpy.uint8) a=numpy.zeros(100,dtype=numpy.uint8) fd = file('test.dat','wb') a.tofile(fd) b.tofile(fd) fd.close() This works fine. However, this does not: fd

Line segments, overlap, and bits

2008-03-26 Thread Sean Davis
I am working with genomic data. Basically, it consists of many tuples of (start,end) on a line. I would like to convert these tuples of (start,end) to a string of bits where a bit is 1 if it is covered by any of the regions described by the (start,end) tuples and 0 if it is not. I then want to d

Telnet versus telnetlib

2008-02-29 Thread Sean Davis
I have used command-line telnet to login to a host, paste into the window a small XML file, and then ^] to leave the window, and quit. This results in a page (described by the XML file) being printed on a printer. When I do an analogous process using telnetlib, I get no debug output, and most impo

XML DOM, but in chunks

2007-10-31 Thread Sean Davis
I have some very large XML files that are basically recordsets. I would like to access each record, one-at-a-time, and I particularly like the ElementTree library for accessing the data. Is there a way to have ElementTree read only one record of the data at a time? Alternatively, are there other

Async XMLRPC and job processing

2007-10-17 Thread Sean Davis
I would like to set up a server that takes XMLRPC requests and processes them asynchronously. The XMLRPC server part is trivial in python. The job processing part is the part that I am having trouble with. I have been looking at how to use threadpool, but I can't see how to get that working. I

Web Ontology Language (OWL) parsing

2007-10-11 Thread Sean Davis
I would like to parse some OWL files, but I haven't dealt with OWL in python or any other language for that matter. Some quick google searches do not turn up much in the way of possibilities for doing so in python. Any suggestions of available code or using existing libraries for doing so? Thank

Making a file-like object for manipulating a large file

2007-08-23 Thread Sean Davis
This should be a relatively simple problem, but I haven't quite got the idea of how to go about it. I have a VERY large file that I would like to load a line at a time, do some manipulations on it, and then make it available to as a file-like object for use as input to a database module (psycopg2)

Re: Fast kNN from python

2007-08-14 Thread Sean Davis
On Aug 14, 6:16 am, Janto Dreijer <[EMAIL PROTECTED]> wrote: > Hi! > > I am looking for a Python implementation or bindings to a library that > can quickly find k-Nearest Neighbors given an arbitrary distance > metric between objects. Specifically, I have an "edit distance" > between objects that i

pyodbc on linux

2007-07-21 Thread Sean Davis
I have read a couple of blogs suggesting that pyodbc is buildable under linux. I am running suse 10.2 on a 64-bit intel machine with unixODBC installed. Upon building, I get a slew of pretty horrid looking errors that make me wonder if this is supposed to work. Can anyone at least confirm that t

odbc module for python

2007-07-18 Thread Sean Davis
What are the alternatives for accessing an ODBC source from python (linux 64-bit, python 2.5)? It looks like mxODBC is the only one available? Thanks, Sean -- http://mail.python.org/mailman/listinfo/python-list

Deferred jobs server as backend for web application

2007-04-11 Thread Sean Davis
In the past, I have put together web applications that process tasks serially, either with short algorithms to manipulate user-submitted data or to return database queries. However, now I am faced with the task of having a long-running process being started by a web submission. I want to process

Re: Graphs, bar charts, etc

2007-02-07 Thread Sean Davis
On Feb 6, 7:57 am, Jan Danielsson <[EMAIL PROTECTED]> wrote: > Hello all, > >I have some data in a postgresql table which I view through a web > interface (the web interface is written in python -- using mod_python > under apache 2.2). Now I would like to represent this data as graphs, > bar ch

Re: Read from database, write to another database, simultaneously

2007-01-11 Thread Sean Davis
On Jan 11, 3:20 am, Laurent Pointal <[EMAIL PROTECTED]> wrote: > Bjoern Schliessmann a écrit : > > > Sean Davis wrote: > > >> The author of one of the python database clients mentioned that > >> using one thread to retrieve the data from the oracle datab

Re: Read from database, write to another database, simultaneously

2007-01-11 Thread Sean Davis
On Jan 10, 9:27 pm, johnf <[EMAIL PROTECTED]> wrote: > Bjoern Schliessmann wrote: > > Sean Davis wrote: > > >> The author of one of the python database clients mentioned that > >> using one thread to retrieve the data from the oracle database and > >&g

Read from database, write to another database, simultaneously

2007-01-10 Thread Sean Davis
I am working on a simple script to read from one database (oracle) and write to another (postgresql). I retrieve the data from oracle in chunks and drop the data to postgresql continuously. The author of one of the python database clients mentioned that using one thread to retrieve the data from

mxODBC problems

2007-01-09 Thread Sean Davis
I have just installed mxODBC on my x86_64 suse linux machine, where I use unixODBC for connection. Running queries from isql or DataManager works fine for the DSN that I am using. However, under mxODBC, I can get a connection object and a cursor object, but all attempts to execute even the simple