Python sqlite and regex.

2006-05-19 Thread Julien ARNOUX
Hi,
I'd like to use regular expressions in sqlite query, I using apsw module
but it doesn't work...Can you help me ?
My script:

import apsw
import re

path = 'db/db.db3'

#regexp function (extract from python-list discusion)
def regexp(expr, item):
reg = re.compile(expr)
return reg.match(item) is not None

con = apsw.Connection(path)
#create function
con.createscalarfunction(REGEXP, regexp)
cur = con.cursor()
#exampl
cur.execute(select foo from test where foo regex 'aa.[0-9]))

and the error is:

cur.execute('select foo from test where foo regex tata')
apsw.SQLError: SQLError: near regex: syntax error

Thanks



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


Read and extract text from pdf

2006-04-24 Thread Julien ARNOUX
Hi,
Thanks I use that and is all right :)

import commands
txt = commands.getoutput('ps2ascii tmp.pdf')
print txt 


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


Read and extract text from pdf

2006-04-21 Thread Julien ARNOUX
Hi,
I have a problem :), I just want to extract text from pdf file with
python. There is differents libraries for that but it doesn't work...

pyPdf and  pdfTools, I don't know why but it doesn't works with some
pdf... For example space chars are delete in the text..
Pdf playground : I don't understand how it work.

If you have an idea, a tutorial, a library or anything who can help me
to do that.

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