Re: fuzzy or boolean text search

2008-12-09 Thread morecowbell
On Dec 9, 12:14 am, John Machin <[EMAIL PROTECTED]> wrote:
> On Dec 9, 4:36 pm, n00b <[EMAIL PROTECTED]> wrote:
>
> > hi,
>
> > i'm looking for advice/suggestions for text search, preferably with
> > boolean or even fuzzy capabilities, and for use with mysql innodb
> > tables.  asking too much :) ???
>
> No ... feeding "fuzzy boolean text search mysql innodb" to my googler
> didn't choke it; it produced this at about the 15th hit:
>
> http://www.sphinxsearch.com/docs/manual-0.9.8.html
>
> Please tell your googler that we all hope that it gets well soon :-)

since you found the list, i presume you can google and looking for
something pythonic. we tried a few options but it's bleak. for a
pythonic solution, look at TextIndexNG3 (Zope). i'll take some
fiddling, though: http://sourceforge.net/projects/textindexng; if
something with a py wrapper will do, you might as well go with the big
guns: lucence. we found that to work very well and that includes SA
integration (http://www.freebsdsoftware.org/textproc/py-lucene.html)
--
http://mail.python.org/mailman/listinfo/python-list


remote unzip

2008-10-31 Thread morecowbell
greetings,


i got a bunch of zip files on a remote server and need to get to one
of the files, an xml file, in each of the archives. fairly simple to
do locally with zipfile but i don't seem to be able to combine that
local code with the paramiko sftp client. a rather simplified code
snippet to illustrate:

import os
import paramiko
import StringIO
import zipfile

remote_file = 'remote.zip'
ssh = paramiko.SSHClient()
ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh",
"known_hosts")))
ssh.connect('www.xxx.com', username='root', password='it_aint')
sftp = ssh.open_sftp()
dirlist = sftp.listdir('.')
zipfile = sftp.file('remote.zip', 'r')
unzip = ZipFile(zfile)
for f in unzip.namelist():
if f.endswith('.xml'):
output.write(unzip.read(unzip))
xmlfiles.append(output.getvalue())

sftp.close()
ssh.close()

any help is greatly appreacited
--
http://mail.python.org/mailman/listinfo/python-list


Re: remote unzip

2008-11-01 Thread morecowbell
On Nov 1, 5:35 am, Stefan Behnel <[EMAIL PROTECTED]> wrote:
> morecowbell wrote:
> > i got a bunch of zip files on a remote server and need to get to one
> > of the files, an xml file, in each of the archives. fairly simple to
> > do locally with zipfile but i don't seem to be able to combine that
> > local code with the paramiko sftp client. a rather simplified code
> > snippet to illustrate:
>
> > import os
> > import paramiko
> > import StringIO
> > import zipfile
>
> > remote_file = 'remote.zip'
> > ssh = paramiko.SSHClient()
> > ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh",
> > "known_hosts")))
> > ssh.connect('www.xxx.com', username='root', password='it_aint')
> > sftp = ssh.open_sftp()
> > dirlist = sftp.listdir('.')
> > zipfile = sftp.file('remote.zip', 'r')
> > unzip = ZipFile(zfile)
> > for f in unzip.namelist():
> >     if f.endswith('.xml'):
> >         output.write(unzip.read(unzip))
> >         xmlfiles.append(output.getvalue())
>
> > sftp.close()
> > ssh.close()
>
> I suppose this code doesn't work for you? What's the output you get?
>
> "don't seem to be able" is not a very helpful problem description.
>
> Stefan

thanks for looking at this. problem is, code seems to get lost in in
space.when the zipfile portion gets invoked:

run this:
import os
import paramiko
import StringIO
import zipfile

remote_file = 'remote.zip'
xml_files = []
ssh = paramiko.SSHClient()
ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh",
"known_hosts")))
try:
ssh.connect('www.xxx.com', username='root', password='itaint')
except Exception, e:
print (e.__class__,e)
sftp = ssh.open_sftp()
dirlist = sftp.listdir('.')
print dirlist
#zfile = sftp.file(remote_file, 'r')
#print zfile
#unzip = ZipFile(zfile)
#for f in unzip.namelist():
#if f.endswith('.xml'):
#output.write(unzip.read(unzip))
#xmlfiles.append(output.getvalue())
sftp.close()
ssh.close()

and we get the dirlist output:
PyMate r8111 running Python 2.5.1 (python)
>>> untitled

['.bash_profile', 'remote.zip', '.zshrc', '.mozilla', '.bash_logout',
'.emacs', '.bashrc']
Program exited.

uncomment the zfile line, i get the paramiko file object:
PyMate r8111 running Python 2.5.1 (python)
>>> untitled

['.bash_profile', 'odb012007101.zip', '.zshrc', '.mozilla',
'.bash_logout', '.emacs', '.bashrc']

Program exited.

uncomment the next line, where the unzipping is done, and the program
goes off to digital neverland. i don't seem to be able to do anything
with the paramiko.STFPfile object. even print dir(zfile) ends up in
the script not completing.

thx



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