RE Help

2007-09-21 Thread byte8bits
Not specific to Python, but it will be implemented in it... how do I compile a RE to catch everything between two know values? Here's what I've tried (but failed) to accomplish... the knowns here are START and END: data = "asdfasgSTARTpruyerfghdfjENDhfawrgbqfgsfgsdfg" x = re.compile('START.END', r

Re: RE Help

2007-09-21 Thread byte8bits
> You'll want to use a non-greedy match: > x = re.compile(r"START(.*?)END", re.DOTALL) > Otherwise the . will match END as well. On Sep 21, 3:23 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Only if there's a later END in the string, in which case the user's > requirements will determine whether

Converting numbers to unicode charaters

2007-09-24 Thread byte8bits
Here's how I'm doing this right now, It's a bit slow. I've just got the code working. I was wondering if there is a more efficient way of doing this... simple example from interactive Python: >>> word = '' >>> hexs = ['42', '72', '61', '64'] >>> for h in hexs: ... char = unichr(int(h, 16)) ...

Re: Script to extract text from PDF files

2007-09-25 Thread byte8bits
On Sep 25, 3:02 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: > Googling for 'pdf to text python' and following the first link > giveshttp://pybrary.net/pyPdf/ Doesn't work that well, I've tried it, you should too... the author even admits this: extractText() [#] Locate all text drawing comman

Re: comparing elements of a list with a string

2007-09-25 Thread byte8bits
On Sep 25, 11:39 am, Shriphani <[EMAIL PROTECTED]> wrote: > If I have a string "fstab", and I want to list out the files in whose names > the word fstab appears should I go about like this : > > def listAllbackups(file): > list_of_files = os.listdir("/home/shriphani/backupdir") > for eleme

Re: Script to extract text from PDF files

2007-09-26 Thread byte8bits
On Sep 25, 10:19 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > > Doesn't work that well... > > This is inherent in the nature of PDF: it's a page-description language, not > a document-interchange language. Each text-drawing command can put a block > of text anywhere

Re: Script to extract text from PDF files

2007-09-26 Thread byte8bits
On Sep 26, 4:49 pm, Svenn Are Bjerkem <[EMAIL PROTECTED]> wrote: > I have downloaded this package and installed it and found that the > text-extraction is more or less useless. Looking into the code and > comparing with the PDF spec show a very early implementation of text > extraction. Luckily it

Re: unit testing

2007-10-05 Thread byte8bits
On Oct 5, 5:38 am, Craig Howard <[EMAIL PROTECTED]> wrote: > Brad: > > If the program is more than 100 lines or is a critical system, I > write a unit test. I hate asking myself, "Did I break something?" > every time I decide to refactor a small section of code. For > instance, I wrote an alarm sys

Re: Finding Peoples' Names in Files

2007-10-11 Thread byte8bits
On Oct 11, 12:49 pm, Matimus <[EMAIL PROTECTED]> wrote: > On Oct 11, 9:11 am, brad <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] wrote: > > > However...how can you know it is a name... > > > OK, I admitted in my first post that it was a crazy question, but if one > > could find an answer,

Re: Entering username & password automatically using urllib.urlopen

2007-10-14 Thread byte8bits
On Oct 13, 11:41 pm, rodrigo <[EMAIL PROTECTED]> wrote: > I am trying to retrieve a password protected page using: > > get = urllib.urlopen('http://password.protected.url";').read() > > While doing this interactively, I'm asked for the username, then the > password at the terminal. > Is there any

Re: Python on imac

2007-10-14 Thread byte8bits
On Oct 14, 1:27 am, James Stroud <[EMAIL PROTECTED]> wrote: > For OS X 10.4, wx has come as part of the stock python install. You may > want to consider going that route if you develop exclusively for OS > X--it will keep the size of your distribution down. > > James wx works well on Macs... Linu

Understanding tempfile.TemporaryFile

2007-12-27 Thread byte8bits
Wondering if someone would help me to better understand tempfile. I attempt to create a tempfile, write to it, read it, but it is not behaving as I expect. Any tips? >>> x = tempfile.TemporaryFile() >>> print x ', mode 'w+b' at 0xab364968> >>> print x.read() >>> print len(x.read()) 0 >>> x.write(

Re: Understanding tempfile.TemporaryFile

2007-12-27 Thread byte8bits
On Dec 27, 10:12 pm, John Machin <[EMAIL PROTECTED]> wrote: > Check out the seek method. Ah yes... thank you: >>> import tempfile >>> x = tempfile.TemporaryFile() >>> x.write("test") >>> print x.read() >>> x.seek(0) >>> print x.read() test -- http://mail.python.org/mailman/listinfo/python-li

pipes python cgi and gnupg

2007-12-28 Thread byte8bits
I think this is more a GnuPG issue than a Python issue, but I wanted to post it here as well in case others could offer suggestions: I can do this from a python cgi script from a browser: os.system("gpg --version > gpg.out") However, I cannot do this from a browser: os.system("echo %s | gpg --b

Python Frontend/GUI for C Program

2008-01-11 Thread byte8bits
I have a C program that works very well. However, being C it has no GUI. Input and Output are stdin and stdout... works great from a terminal. Just wondering, has anyone every written a Python GUI for an existing C program? Any notes or documentation available? I have experience using wxPython fro