Re: Recognizing the Arrival of a New File

2005-03-09 Thread Chris Green
Greg Lindstrom <[EMAIL PROTECTED]> writes: > Hello- > I am writing an application where I need to recognize when a file > arrives in a given directory. Files may arrive at any time during the > course of the day. Do I set up a cron job to poll the directory every > few minutes? Write a daemo

Re: An Odd Little Script

2005-03-09 Thread James Stroud
This might be hack-ish, more elegant solutions are likely to exist, but this is the general idea: LINEFEED = "\n" # or whatever EOR = "?"# or whatever def fixEOR(filename): f = open(filename,"r+") byte = True # loops through whole file while True: # loops through record

Re: An Odd Little Script

2005-03-09 Thread M.E.Farmer
Greg Lindstrom wrote: > Hello- > > I have a task which -- dare I say -- would be easy in > Perl but would rather do in Python (our primary > language at Novasys). I have a file with varying length records. All > but the first record, that is; it's always 107 bytes long. What I would > like to d

Re: An Odd Little Script

2005-03-09 Thread Benji York
Greg Lindstrom wrote: I have a task which -- dare I say -- would be easy in Perl but would rather do in Python (our primary language at Novasys). I have a file with varying length records. All but the first record, that is; it's always 107 bytes long. I intuit that you are dealing with EDI

Re: Is there a short-circuiting dictionary "get" method?

2005-03-09 Thread Jeff Epler
untested def my_getter(m, i, f): try: return m[i] except (KeyError, IndexError): return f() my_getter(d, 'x', bigscaryfunction) my_getter(d, 'y', lambda: scaryinlineexpresion) pgp04VRKFqQL1.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python

Re: How to allow events during long processing routine?

2005-03-09 Thread M.E.Farmer
Survey says. ...wxYield() ;) M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list

Re: distutils: binary distribution?

2005-03-09 Thread "Martin v. Löwis"
Stefan Waizmann wrote: I would like the distutils are creating a binary distribution only - means create the distribution file with *.pyc files WITHOUT the *.py files. Any ideas? You will need to create your own command. You can either specialize the build command, to not copy the source code (mor

Re: Unicode BOM marks

2005-03-09 Thread "Martin v. LÃwis"
Steve Horsley wrote: It is my understanding that the BOM (U+feff) is actually the Unicode character "Non-breaking zero-width space". My understanding is that this used to be the case. According to http://www.unicode.org/faq/utf_bom.html#38 the application should now specify specific processing,

Re: os.walk(entire filesystem)

2005-03-09 Thread Peter Hansen
rbt wrote: More of an OS question than a Python question, but it is Python related so here goes: When I do os.walk('/') on a Linux computer, the entire file system is walked. On windows, however, I can only walk one drive at a time (C:\, D:\, etc.). Is there a way to make os.walk() behave on Wi

Re: An Odd Little Script

2005-03-09 Thread Michael Hoffman
Michael Hoffman wrote: Greg Lindstrom wrote: I have a file with varying length records. All but the first record, that is; it's always 107 bytes long. What I would like to do is strip out all linefeeds from the file, read the character in position 107 (the end of segment delimiter) and then re

Re: PythonWin line spacing

2005-03-09 Thread Neil Hodgson
Thomas Philips: > I've just downloaded and installed ActivePython and am trying to > customize the PythonWin editor. Its line spacing seems to default to 2, > and consequently, I cannot see many lines of code on a screen. How do I > set the line spacing to 1? I presume you are talking about th

Re: os.walk(entire filesystem)

2005-03-09 Thread Tobiah
When I do os.walk('/') on a Linux computer, the entire file system is walked. On windows, however, I can only walk one drive at a time (C:\, D:\, etc.). If this is a personal utility for one computer, and if you run XP on that computer, then you have the ability to mount secondary drives on to

Re: os.walk(entire filesystem)

2005-03-09 Thread Larry Bates
I don't think what you want would even work. You can't walk A: unless a floppy is present, O/S will bark at you. You can't walk D: (cdrom drive) unless a CDROM is present. What about network drives??? Unlike Linux where these directories appear to be empty if nothing is mounted Windows tries to

Re: capturing text from a GUI window

2005-03-09 Thread Earl Eiland
On Tue, 2005-03-08 at 14:27, [EMAIL PROTECTED] wrote: > Earl Eiland wrote: > > Anyone know how to capture text from GUI output? I need to process > > information returned via a GUI window. > > > > Earl > > Assuming Windows, then these guys have an interesting tool: > http://www.skesoft.com/te

email.Message.set_charset and Content-Transfer-Encoding

2005-03-09 Thread David Bolen
I've noticed that using set_charset() on an email.Message instance will not replace any existing Content-Transfer-Encoding header but will install one if it isn't yet present. Thus, if you initially create a message without a charset, it defaults to us-ascii, and creates both Content-Type and Cont

Re: python cvs interface?

2005-03-09 Thread corey
Ah, unfortunately it looks like this program uses something called gcvs, a gtk cvs interface written in C++, for interfacing to low level cvs routines. So it probably won't work for me. Oh well. Anyone else have any suggestions? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to allow events during long processing routine?

2005-03-09 Thread Brent W. Hughes
Thanks, M.E.Farmer. I continue to be impressed with how quickly and nicely one can get help here. Brent "M.E.Farmer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Survey says. > ...wxYield() > > ;) > M.E.Farmer > -- http://mail.python.or

Usage example for ANSI.py from the pexpect package

2005-03-09 Thread Eric Myers
Hello folks: (This message is also posted on the help forum at the pexpect sourceforge page, but all indentation in the code got stripped away when I submitted the post.) For some time I've wanted to make use of the ANSI.py module in the pexpect package to handle screen-based telnet sessions in P

Re: os.walk(entire filesystem)

2005-03-09 Thread Grumman
Tobiah wrote: When I do os.walk('/') on a Linux computer, the entire file system is walked. On windows, however, I can only walk one drive at a time (C:\, D:\, etc.). If this is a personal utility for one computer, and if you run XP on that computer, then you have the ability to mount secondar

hotshot load error

2005-03-09 Thread Charles Hartman
I've used profile before, but wanted to get more information so I thought I'd try hotshot instead. It works fine when used like profile. But when I run it using this line, prof = hotshot.Profile('ScanHot.prof', lineevents=1) though it runs all right, when I try to load the resulting file I get

Re: read() / readline() / readlines()

2005-03-09 Thread Dave Lajoie
Fyi, I found the answer ( at least one that still works )   def PrintThread(myThread):    while myThread.isAlive() == True:    line = p.stdout.readline()[:-1]    if line == "":    continue    if line == '\0':    break    print line   Dave. -

SimpleHTTPRequestHandler handling long lasting requests problem

2005-03-09 Thread Andy Leszczynski
I need a HTTP server handling long lasting requests e.g. 10-30 seconds. Below is a pice of the code. In order to make the server reponsive while handling othere requests I use SocketServer.ThreadingMixIn. However the problem is the it does not work out. I checked thet a new thread is created fo

BaseHTTPServer.BaseHTTPRequestHandler and HTTP chunking

2005-03-09 Thread Andy Leszczynski
Does BaseHTTPServer.BaseHTTPRequestHandler support HTTP protocol chunking? Thanks, Andy -- http://mail.python.org/mailman/listinfo/python-list

looking for case insesitive dictionary

2005-03-09 Thread Andy Leszczynski
so e.g. x={} x['a']=1 x['A']=2 print x['a'] #prints 2 Thx, A. -- http://mail.python.org/mailman/listinfo/python-list

Re: looking for case insesitive dictionary

2005-03-09 Thread Michael Spencer
Andy Leszczynski wrote: so e.g. x={} x['a']=1 x['A']=2 print x['a'] #prints 2 Thx, A. http://www.google.com/search?&q=python+case+insensitive+dictionary Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: BaseHTTPServer.BaseHTTPRequestHandler and HTTP chunking

2005-03-09 Thread Steve Holden
Andy Leszczynski wrote: Does BaseHTTPServer.BaseHTTPRequestHandler support HTTP protocol chunking? No. Hardly any HTTP 1.1 features are supported. regards Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: capturing text from a GUI window

2005-03-09 Thread Myles Strous
Earl Eiland wrote: > This sounds like just what I need. What is COM, and where do I get it? Also worth checking out: Simon Brunning's WinGuiAuto - control/query of windows and controls, including the function getEditText to read the text in an edit control. See http://www.brunningonline.net/simo

thread end and make main program end also?

2005-03-09 Thread martinnitram
Dear all, Following are some codes: from myClass import * # some user define classes, which will catch the exception within its function thread_function(): myClass myclass while (1): returnValue = myclass.myfunction(); print "Return Value %s" % returnValue

Re: reading timestamp from vid file (avi)

2005-03-09 Thread flupke
Lucas Raab wrote: flupke wrote: Hi, i capture a movie from mividv to an avi containing the dv video. I found a program that reads the timestamp from the avi so you know the exact date and time the video was shot. However, the source of that program is not available and it doesn't allow to batch

<    1   2