Checking free disk space on Win32 ?

2006-01-27 Thread guychuk
I found old threads with no clear answer, how to do it? Thanks! Guy -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs C for a mail server

2006-01-27 Thread Ravi Teja
>> Why don't you use an existing mail server? Probably because that was his homework assignment for a networking class. Not uncommon to be told to implement a server from the scratch from the RFC. Although that does not explain his concern about performance. Abhinav, if that is the case, using so

Re: Python vs C for a mail server

2006-01-27 Thread Steven D'Aprano
On Fri, 27 Jan 2006 22:43:48 -0800, abhinav wrote: > Hello guys, > I am a novice in python.I have to implement a full fledged mail server Because that's just what the world needs, yet another mail server. Why don't you use an existing mail server? > .But i am not able to choose the language.Sho

Re: Returning a value from code string

2006-01-27 Thread Fredrik Lundh
Kirk McDonald wrote: > def __call__(self, args=None, **kwargs): > # We can pass in a name/value dictionary > if args: kwargs.update(args) > exec self.code > # We don't need a standard function if we're not returning > # anything > if local

Re: Loading a Python collection from an text-file

2006-01-27 Thread Fredrik Lundh
Ido Yehieli wrote: > >>Sure, it's just a Python module with variables in it. > >> > >>I wouldn't try to teach my users Python syntax though. > > not to mention the security risks you mean all the things they can do from inside python that they cannot do from the command line ? -- http://mai

Python vs C for a mail server

2006-01-27 Thread abhinav
Hello guys, I am a novice in python.I have to implement a full fledged mail server .But i am not able to choose the language.Should i go for C(socket API) or python for this project? What are the advantages of one over the other in implementing this server.which language will be easier? What are th

Re: Efficient Find and Replace

2006-01-27 Thread Fredrik Lundh
Raymond Hettinger wrote: > > for i,v in enumerate(L): > > if v == X: > > L[i] = Y > > Here's an alternate solution using a replacement dictionary: > > M = {X:Y} > for i, v in enumerate(L): > L[i] = M.get(v, v) but that's 2-3 times slower than the OP's corrected code for his

Solved: popen4("python -u script.py") redirected to a gui window

2006-01-27 Thread André
Sorry about the single-author thread; I have been googling for answers and trying out for 3 nights... I just want to record to save others the trouble. > Earlier this evening, I wrote: > > Short description: Using a wxPython based app, I would like to take a > > python script in an editor window,

Re: Using non-ascii symbols

2006-01-27 Thread Runsun Pan
On 1/27/06, Terry Hancock <[EMAIL PROTECTED]> wrote: > Well, let's just say, I think there should be different > standards for "write once / read once" versus "write once / > read many". The mere use of written language once implied > the latter, but I suppose text messaging breaks that rule. Sin

Re: Returning a value from code string

2006-01-27 Thread Kirk McDonald
Steven D'Aprano wrote: > On Fri, 27 Jan 2006 20:33:53 -0800, Kirk McDonald wrote: > > >> Say I have a database containing chunks of Python code. I already >> have a way to easily load, edit, and save them. > > > Why? I am implementing an Everything Engine-like system (see everything2.com and

Re: Returning a value from code string

2006-01-27 Thread Steven D'Aprano
On Fri, 27 Jan 2006 20:33:53 -0800, Kirk McDonald wrote: > Say I have a database containing chunks of Python code. I already have a > way to easily load, edit, and save them. Why? > What is slightly baffling to me > is how I can effectively pass this code some arguments, run it, and > someh

Re: Being unjust

2006-01-27 Thread floydophone
Here's what I think should go in the standard library: - A set of battle-hardened WSGI gateways (CherryPy's WSGI server, ISAPI-WSGI, mpcp, PEP-333's CGI gateway, flup's fastcgi and scgi support). I think that if we included a WSGI app server with a snazzy administration user interface (ala ColdFus

Re: Efficient Find and Replace

2006-01-27 Thread Raymond Hettinger
[David Hirschfield] > for i,v in enumerate(L): > if v == X: > L[i] = Y Here's an alternate solution using a replacement dictionary: M = {X:Y} for i, v in enumerate(L): L[i] = M.get(v, v) The replacement dictionary directly supports generalization to multiple substitution pa

*Almost working* >:-( popen4("python -u script.py") redirected to a gui window

2006-01-27 Thread André
Earlier this evening, I wrote: > Short description: Using a wxPython based app, I would like to take a > python script in an editor window, invoke the python interpreter and > use another window as stdin/stdout/stderr. > [snip] Ok, I got almost everything working ... except the stdin redirection. I

Returning a value from code string

2006-01-27 Thread Kirk McDonald
Say I have a database containing chunks of Python code. I already have a way to easily load, edit, and save them. What is slightly baffling to me is how I can effectively pass this code some arguments, run it, and somehow get a return value. (Acutally, in the process of writing this post, I fig

Re: How do I tell if I'm running in the PyWin interpreter?

2006-01-27 Thread Charles Krug
On 2006-01-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >> As the comment says, when I run this under Python Win, I get an (pretty >> sure) Tkinter interface, not a command line, and I don't get my >> EOFError when I expect to. > > When do you expect to get an EOFError? The only way I get an

Re: VB to Python migration

2006-01-27 Thread Steven D'Aprano
On Fri, 27 Jan 2006 23:48:51 +, Josh wrote: > We have a program written in VB6 (over 100,000 lines of code and 230 UI > screens) that we want to get out of VB and into a better language. The > program is over 10 years old and has already been ported from VB3 to > VB6, a job which took over

Re: VB to Python migration

2006-01-27 Thread Ravi Teja
230 UI screens is a lot. An app of that nature is not something people commonly do in Python (although I would be happy to see people show me wrong). You are building a GUI app that likely need not run anywhere except on Windows and perhaps most what of what is does is edit and report on data from

Re: How do I tell if I'm running in the PyWin interpreter?

2006-01-27 Thread Steven D'Aprano
On Fri, 27 Jan 2006 21:05:43 -0600, Charles Krug wrote: > Here's the deal: > > I've a dead-simple command-line program I'm using to test things that I > can't (for various reasons) test in the IDE. > > Here's a do-nothing subset that shows the idea: > > # insanely simply command interpreter > i

Re: [IDE] - The Dynamic Opportunity - ActiveState Komodo IDE / Open Source

2006-01-27 Thread Ilias Lazaridis
Ed Leafe wrote: > On Jan 26, 2006, at 6:37 PM, Ilias Lazaridis wrote: > >> As a first step, a free personal edition (non-commercial and academic >> use) would help to spread the Komodo IDE within the communities. >> >> This would be a gentle contribution to the open source dynamic >> languages, wh

Re: How do I dynamically create functions without lambda?

2006-01-27 Thread Scott David Daniels
Steven D'Aprano wrote: > On Fri, 27 Jan 2006 11:41:56 -0800, Kay Schluehr wrote: > >> Russell wrote: >>> I want my code to be Python 3000 compliant, and hear >>> that lambda is being eliminated. The problem is that I >>> want to partially bind an existing function with a value >>> "foo" that isn't

Re: py-ext: casting pointers to ints on 32bit and 64bit systems

2006-01-27 Thread David Rushby
Alexander Schmolck wrote: > what's the best approach to write C(++)-extension code that has to create a > python int from a C pointer and vice versa so that it works smoothly on 32 bit > and 64 platforms (on which sizeof(int) != sizeof(*void)) equally work (under > unix,mac&windows and with gcc, vc

How do I tell if I'm running in the PyWin interpreter?

2006-01-27 Thread Charles Krug
Here's the deal: I've a dead-simple command-line program I'm using to test things that I can't (for various reasons) test in the IDE. Here's a do-nothing subset that shows the idea: # insanely simply command interpreter import Commands import sys myPrompt = '$> ' # Raw Input doesn't QUITE do w

Re: beta.python.org content

2006-01-27 Thread Shalabh Chaturvedi
Magnus Lycka wrote: > > Perhaps the "About Section" should look like this? > > Introduction > -What is Python [short summary] > -Getting started[a.k.a. for beginners/programmers, how to d/l etc] > -Why Python?[a.k.a. for business] > -Success Stories > -Quotes +1 > I don't quite

Re: beta.python.org content

2006-01-27 Thread Shalabh Chaturvedi
> Shalabh Chaturvedi wrote: >> 2. "also available as the python-list mailing list" >> >> Add "or a google group (link)". >> Steve Holden wrote: > Gimme the link! http://groups.google.com/group/comp.lang.python You could even use the text: also available as the python-list mailing list via a `w

cookielib extracting a cookie value as a string

2006-01-27 Thread dmbkiwi
I am trying to extract the value of a cookie from a CookieJar() object using cookielib. I have a CookieJar() object called cj. Printing cj gives: <_LWPCookieJar.LWPCookieJar[, ]> But i can't work out how to extract the value. If I use make_cookies(), I get: [Cookie(version=0, name='GA3T', val

Re: indentation messing up my tuple?

2006-01-27 Thread bonono
Steven D'Aprano wrote: > On Fri, 27 Jan 2006 16:45:54 -0800, localpricemaps wrote: > > > here is my code: > > > > for row in bs('div', {'style' : 'both'}): > > What is bs? Is it a secret? seems to be beautiful soup, in this context. -- http://mail.python.org/mailman/listinfo/python-list

Re: VB to Python migration

2006-01-27 Thread Nicolas Kassis
Josh wrote: > We have a program written in VB6 (over 100,000 lines of code and > 230 UI screens) that we want to get out of VB and into a better > language. The program is over 10 years old and has already been > ported from VB3 to VB6, a job which took over two years. We would > like to port it t

equivalent to c++ "reference" or "pointers"

2006-01-27 Thread Collin Jones
Hello,Is there a Python equivalent to creating "reference" or "pointer"-type variables as in C++??  I'm trying to create a couple classes that have something like a container-and-iterator relationship; one class acts as a data resource (container-like) and can be queried by multiple control classes

Re: Efficient Find and Replace

2006-01-27 Thread Steven D'Aprano
On Fri, 27 Jan 2006 16:49:24 -0800, David Hirschfield wrote: > You aren't getting too many helpful responses. Surely pointing out the poster's incorrect assumptions is helpful? If I said, "I want to add two integers together, but Python's + only does string concatenation, so I wrote this functio

Re: indentation messing up my tuple?

2006-01-27 Thread Steven D'Aprano
On Fri, 27 Jan 2006 16:45:54 -0800, localpricemaps wrote: > here is my code: > > for row in bs('div', {'style' : 'both'}): What is bs? Is it a secret? > data=[] > > for incident in bs('h3', {'class' : 'name'}): > foodlist = [] > for oText in incid

Re: Using non-ascii symbols

2006-01-27 Thread Dan Sommers
On Fri, 27 Jan 2006 22:29:20 GMT, Neil Hodgson <[EMAIL PROTECTED]> wrote: > ... I'm so used to "/" for division that "÷" now looks strange. Strange, indeed, and too close to + for me (at least within my newsreader). Regards, Dan -- Dan Sommers -- http://mai

Re: Efficient Find and Replace

2006-01-27 Thread Steven D'Aprano
On Fri, 27 Jan 2006 16:34:53 -0800, Murali wrote: > I did not actually run the code, so there may be syntax errors and so > forth. But how is L[x] = Y an O(1) operation. Given x finding L[x] > would require to traverse x nodes in the list. So finding L[x] requires > O(x) time. Once you find L[x] s

Re: Efficient Find and Replace

2006-01-27 Thread Fredrik Lundh
Murali wrote: > I did not actually run the code, so there may be syntax errors and so > forth. But how is L[x] = Y an O(1) operation. Given x finding L[x] > would require to traverse x nodes in the list. So finding L[x] requires > O(x) time. no, L[x] is an O(1) operation in both Python and C. th

indentation messing up my tuple?

2006-01-27 Thread localpricemaps
i have the following code which is used to create a tuple of food and drink. if the page i am trying to scrape has a total of 10 food/drink items that i end up getting a nice list of 10 food/drink items in my text file BUT they are all a repeat of the first item so i end up getting a text file tha

Re: Efficient Find and Replace

2006-01-27 Thread David Hirschfield
You aren't getting too many helpful responses. Hope this one helps: The closest python equivalent to: p = head(L) while (p) { if (p->data == X) p->data = Y; } would be: for i,v in enumerate(L): if v == X: L[i] = Y modifies the list in place. There's nothing wrong with just doing

Re: Efficient Find and Replace

2006-01-27 Thread bearophileHUGS
>But how is L[x] = Y an O(1) operation. Given x finding L[x] would require to >traverse x nodes in the list. Python list is a deceptive name, because they are 1D arrays of pointers. Maybe they are called lists because array(...) is shorter than list(...). Bye, bearophile -- http://mail.python.

Re: How do I dynamically create functions without lambda?

2006-01-27 Thread Steven D'Aprano
On Fri, 27 Jan 2006 11:41:56 -0800, Kay Schluehr wrote: > > Russell wrote: >> I want my code to be Python 3000 compliant, and hear >> that lambda is being eliminated. The problem is that I >> want to partially bind an existing function with a value >> "foo" that isn't known until run-time: >> >>

Re: Efficient Find and Replace

2006-01-27 Thread Murali
I did not actually run the code, so there may be syntax errors and so forth. But how is L[x] = Y an O(1) operation. Given x finding L[x] would require to traverse x nodes in the list. So finding L[x] requires O(x) time. Once you find L[x] setting it to Y is O(1) I agree. In Solution B: By L.index(

Re: Efficient Find and Replace

2006-01-27 Thread bearophileHUGS
>Because L.index() and L[x:x] both take O(N) time in the worst case. Why do you think L[x:x] can be O(N)? This looks O-linear enough to me: >>> from random import choice >>> L = [choice("ab") for i in xrange(10)] >>> L ['b', 'b', 'b', 'a', 'b', 'a', 'b', 'a', 'a', 'a'] >>> for x in xrange(len(L)

Howto? popen4("python -u script.py") redirected to a gui window

2006-01-27 Thread André
Short description: Using a wxPython based app, I would like to take a python script in an editor window, invoke the python interpreter and use another window as stdin/stdout/stderr. Based on what I've read so far, I've figured that I need to do something like: f_in, f_out = popen4("python -u scrip

Re: Python String Substitution

2006-01-27 Thread Steven D'Aprano
On Fri, 27 Jan 2006 15:54:30 -0800, Murali wrote: > No. I dont have a real life example. I was explaining % substitution to > somebody and realized that I have only used it in the form where the > keys are strings. Was wondering if there is some special syntax already > part of python with which I

Re: Efficient Find and Replace

2006-01-27 Thread Fredrik Lundh
Murali wrote: > Now I dont want to create another list but just modify it in place. Why does that matter? List copies are cheap. > SolutionA: > > for x in range(len(L)): > if L[x] == X: >L[x:x] = Y Did you run this code ? > SolutionB: > > p = L.index(X) > while p >= 0: >L[p:p]

Re: Codec Search Function

2006-01-27 Thread Giovanni Bajo
James Stroud wrote: > How do I get the SVN version? Maybe that is not the one I have. svn export svn://pyinstaller.hpcf.upr.edu/trunk pyinstaller > This > crashes on the version I have (complete program listing): > > "abcde".encode('hex') > > LookupError: no codec search functions registered

Re: obtain client ip address from SimpleXMLRPCServer ?

2006-01-27 Thread Peter Gsellmann
[EMAIL PROTECTED] wrote: > Thanks for the reply Peter. Can you provide a code snippet for > extracting this data. When I print the dir() of the SimpleXMLRPCServer > instance I do not see a request_handler attribute or method. this is ok. In the serverclass-object, there is no such method because

Efficient Find and Replace

2006-01-27 Thread Murali
Given: L = list of integers. X and Y are integers. Problem: find every occurence of X and replace with Y Solution1: def check(s): if s==X: return Y else return s newL = [ check(s) for s in L] Now I dont want to create another list but just modify it in place. SolutionA: for x

Re: Python String Substitution

2006-01-27 Thread Murali
No. I dont have a real life example. I was explaining % substitution to somebody and realized that I have only used it in the form where the keys are strings. Was wondering if there is some special syntax already part of python with which I can lookup the dictionary using a tuple as a key. - Mural

Re: Using non-ascii symbols

2006-01-27 Thread Terry Hancock
On Fri, 27 Jan 2006 12:50:03 -0600 Runsun Pan <[EMAIL PROTECTED]> wrote: > On 1/27/06, Magnus Lycka <[EMAIL PROTECTED]> wrote: > > Actually, it seems that recent habit of sending text > > messages via mobile phones is the prime driver for > > reformed spelling these days. OMG ru kdng? Make it sto

Re: beta.python.org content

2006-01-27 Thread Terry Hancock
On Fri, 27 Jan 2006 13:44:19 -0800 Scott David Daniels <[EMAIL PROTECTED]> wrote: > Paragraph 3 in "Why Python": >Some people uppose because Python ... > I'd prefer the word "suppose." > and later in that paragraph, I'd change: > ... extensions that provide compact numerical > solutio

VB to Python migration

2006-01-27 Thread Josh
We have a program written in VB6 (over 100,000 lines of code and 230 UI screens) that we want to get out of VB and into a better language. The program is over 10 years old and has already been ported from VB3 to VB6, a job which took over two years. We would like to port it to Python, but we ne

Re: writing large files quickly

2006-01-27 Thread Grant Edwards
On 2006-01-27, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> Because it isn't really writing the zeros. You can make these >> files all day long and not run out of disk space, because this >> kind of file doesn't take very many blocks. The blocks that >> were never written are virtual blocks,

Re: writing large files quickly

2006-01-27 Thread Ivan Voras
Steven D'Aprano wrote: > Isn't this a file system specific solution though? Won't your file system > need to have support for "sparse files", or else it won't work? Yes, but AFAIK the only "modern" (meaning: in wide use today) file system that doesn't have this support is FAT/FAT32. -- http://m

Re: generating method names 'dynamically'

2006-01-27 Thread Daniel Nogradi
> *>* I don't get it, why is it more safe to accept GET variables than > *>* method names? Concretely, why is the URL > *>* http://something.com/script?q=parameter safer than > *>* http://something.com/script/parameter if in both cases exactly the > *>* same things are happening with 'parameter'? >

Re: How do I dynamically create functions without lambda?

2006-01-27 Thread Steven Bethard
Russell wrote: > I want my code to be Python 3000 compliant, and hear > that lambda is being eliminated. The problem is that I > want to partially bind an existing function with a value > "foo" that isn't known until run-time: > >someobject.newfunc = lambda x: f(foo, x) > > The reason a neste

Re: writing large files quickly

2006-01-27 Thread Steven D'Aprano
On Fri, 27 Jan 2006 12:30:49 -0800, Donn Cave wrote: > In article <[EMAIL PROTECTED]>, > rbt <[EMAIL PROTECTED]> wrote: >> Won't work!? It's absolutely fabulous! I just need something big, quick >> and zeros work great. >> >> How the heck does that make a 400 MB file that fast? It literally tak

Re: py-ext: casting pointers to ints on 32bit and 64bit systems

2006-01-27 Thread Thomas Heller
Alexander Schmolck <[EMAIL PROTECTED]> writes: > what's the best approach to write C(++)-extension code that has to > create a python int from a C pointer and vice versa so that it works > smoothly on 32 bit and 64 platforms (on which sizeof(int) != > sizeof(*void)) equally work (under unix,mac&wi

Re: Question about isinstance()

2006-01-27 Thread Rene Pijlman
Marc 'BlackJack' Rintsch: >Rene Pijlman: >> Well no, when comparing against things you didn't think of the __eq__ >> shouldn't return a false False, it should return NotImplemented. After >> all, the things you didn't think of are not (yet) implemented. > >I think Steven thinks that it is possible

Re: How do I dynamically create functions without lambda?

2006-01-27 Thread Gary Herron
Russell wrote: >I want my code to be Python 3000 compliant, and hear >that lambda is being eliminated. The problem is that I >want to partially bind an existing function with a value >"foo" that isn't known until run-time: > > someobject.newfunc = lambda x: f(foo, x) > >The reason a nested funct

py-ext: casting pointers to ints on 32bit and 64bit systems

2006-01-27 Thread Alexander Schmolck
what's the best approach to write C(++)-extension code that has to create a python int from a C pointer and vice versa so that it works smoothly on 32 bit and 64 platforms (on which sizeof(int) != sizeof(*void)) equally work (under unix,mac&windows and with gcc, vc and borland)? Currently the rele

Re: Question about isinstance()

2006-01-27 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Rene Pijlman wrote: > Steven D'Aprano: >>Rene Pijlman: >>> Mr.Rech: def __eq__(self, other): try: return self.an_attribute == other.an_attribute except AttributeError: return False >>> >>> This may give unexpected result

Re: Using non-ascii symbols

2006-01-27 Thread Neil Hodgson
Having a bit of a play with some of my spam reduction code. Original: def isMostlyCyrillic(u): if type(u) != type(u""): u = unicode(u, "UTF-8") cnt = float(sum(0x400 <= ord(c) < 0x500 for c in u)) return (cnt > 1) and ((cnt / len(u)) > 0.5) Using more mathematical ope

Re: 2-dimensional data structures

2006-01-27 Thread Grant Edwards
On 2006-01-26, Larry Bates <[EMAIL PROTECTED]> wrote: >> I want to work on a sudoku brute-forcer, just for fun. >> >> I am considering different strategies, but first I need to decide on the >> data-structure to use for the progress/solution grid. >> >> This being a square, I would have used a 9

Re: 2-dimensional data structures

2006-01-27 Thread Scott David Daniels
Claudio Grondi wrote: > anthonyberet wrote: >> Hello again - rather a newbie here... >> I am considering different strategies, but first I need to decide on >> the data-structure to use for the progress/solution grid. > > ... define your grid as a dictionary in a following way: > grid = {} > for

Re: Using non-ascii symbols

2006-01-27 Thread Rocco Moretti
Ivan Voras wrote: > It's not a far-out idea. I stumbled about a year ago on a programming > language that INSISTED on unicode characters like ≤ as well as the rest > of mathematical/logical symbols; I don't remember its name but the > source code with characters like that looked absolutely beau

Re: beta.python.org content

2006-01-27 Thread Scott David Daniels
Steve Holden wrote: > How does > > http://beta.python.org/about/beginners/ > > look? > > regards > Steve I agree that links need better contrast (if you are taking over the page coloring; you might consider avoiding that as well as font spec). In the initial paragraph: Welcome! Are you

Re: Printing HTML

2006-01-27 Thread Max
Rene Pijlman wrote: > Max <[EMAIL PROTECTED]>: > >>How can I print (as in laser printer, not the python print statement) >>HTML from Python > > > Is the printer attached to your server, or are you printing over the > internet? > I'm not sure if the printer is attached to the workstation (pro

Re: decorators to add test* TestCase methods

2006-01-27 Thread Bruce Cropley
Many thanks for that! It looks like it's time to learn about metaclasses. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: writing large files quickly

2006-01-27 Thread Grant Edwards
On 2006-01-27, rbt <[EMAIL PROTECTED]> wrote: > OK I finally get it. It's too good to be true :) Sorry about that. I should have paid closer attention to what you were going to do with the file. > I'm going back to using _real_ files... files that don't look > as if they are there but aren't. B

Re: writing large files quickly

2006-01-27 Thread Grant Edwards
On 2006-01-27, Erik Andreas Brandstadmoen <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> Because the filesystem code keeps track of where you are in >> that 400MB stream, and returns 0x00 anytime you're reading from >> a "hole". The "cp" program and the "md5sum" just open the file >> and sta

Re: writing large files quickly

2006-01-27 Thread rbt
Grant Edwards wrote: > On 2006-01-27, rbt <[EMAIL PROTECTED]> wrote: > > >>Hmmm... when I copy the file to a different drive, it takes up >>409,600,000 bytes. Also, an md5 checksum on the generated file and on >>copies placed on other drives are the same. It looks like a regular, big >>file...

Re: How do I dynamically create functions without lambda?

2006-01-27 Thread James Stroud
Kay Schluehr wrote: > Russell wrote: > >>I want my code to be Python 3000 compliant, and hear >>that lambda is being eliminated. The problem is that I >>want to partially bind an existing function with a value >>"foo" that isn't known until run-time: >> >> someobject.newfunc = lambda x: f(foo, x

Re: writing large files quickly

2006-01-27 Thread Grant Edwards
On 2006-01-27, rbt <[EMAIL PROTECTED]> wrote: > OK, I'm still trying to pick my jaw up off of the floor. One > question... how big of a file could this method create? 20GB, > 30GB, limit depends on filesystem, etc? Right. Back in the day, the old libc and ext2 code had a 2GB file size limit at

Re: Match First Sequence in Regular Expression?

2006-01-27 Thread Scott David Daniels
How about: pattern = re.compile('^([^a]|(a+[^ab]))*aaab') Which basically says, "precede with arbitrarily many non-a's or a sequences ending in non-b, then must have 3 as followed by a b." cases = ["xyz123aaabbab", "xayz123aaabab", "xaaayz123aaabab", "xyz123babaaabab", "xyz123aabbaaab

Re: writing large files quickly

2006-01-27 Thread Erik Andreas Brandstadmoen
Grant Edwards wrote: > Because the filesystem code keeps track of where you are in > that 400MB stream, and returns 0x00 anytime you're reading from > a "hole". The "cp" program and the "md5sum" just open the file > and start read()ing. The filesystem code returns 0x00 bytes > for all of the read

Re: HTMLTestRunner - generates HTML test report for unittest

2006-01-27 Thread aurora
On Fri, 27 Jan 2006 06:35:46 -0800, Paul McGuire <[EMAIL PROTECTED]> wrote: > Nice! I just adapted my pyparsing unit tests to use this tool - took me > about 3 minutes, and now it's much easier to run and review my unit test > results. I especially like the pass/fail color coding, and the > "

Re: writing large files quickly

2006-01-27 Thread Grant Edwards
On 2006-01-27, rbt <[EMAIL PROTECTED]> wrote: > Hmmm... when I copy the file to a different drive, it takes up > 409,600,000 bytes. Also, an md5 checksum on the generated file and on > copies placed on other drives are the same. It looks like a regular, big > file... I don't get it. Because th

Re: writing large files quickly

2006-01-27 Thread Grant Edwards
On 2006-01-27, rbt <[EMAIL PROTECTED]> wrote: >fd.write('0') >>> >>>[cut] >>> f = file('large_file.bin','wb') f.seek(40960-1) f.write('\x00') >>> >>>While a mindblowingly simple/elegant/fast solution (kudos!), the >>>OP's file ends up with full of the character zero (ASCII

Re: writing large files quickly

2006-01-27 Thread Robert Kern
rbt wrote: > Hmmm... when I copy the file to a different drive, it takes up > 409,600,000 bytes. Also, an md5 checksum on the generated file and on > copies placed on other drives are the same. It looks like a regular, big > file... I don't get it. google("sparse files") -- Robert Kern [EMAI

Re: 2-dimensional data structures

2006-01-27 Thread Max
Claudio Grondi wrote: > > Another approach as already proposed could be, that you define your grid > as a dictionary in a following way: > grid = {} > for column in range(1,10): > for row in range(1,10): > grid[(column, row)] = None > # then you can refer to the cells of the 'array' like: >

Re: Using non-ascii symbols

2006-01-27 Thread Ivan Voras
Robert Kern wrote: > On OS X, > > ≤ is Alt-, > ≥ is Alt-. > ≠ is Alt-= Thumbs up on the unicode idea, but national keyboards (i.e. non-english) have already used almost every possible not-strictly-defined-in-EN-keyboards combination of keys for their own characters. In particular, the key com

Re: writing large files quickly

2006-01-27 Thread rbt
Donn Cave wrote: > In article <[EMAIL PROTECTED]>, > rbt <[EMAIL PROTECTED]> wrote: > >>Won't work!? It's absolutely fabulous! I just need something big, quick >>and zeros work great. >> >>How the heck does that make a 400 MB file that fast? It literally takes >>a second or two while every othe

jython/python: read file and allow read to be terminated

2006-01-27 Thread py
i need to read the contents of a file (could be 100kb, could be 500mb, could be 1gb)...but I want to allow the read to be canceled. for example, say a user wants to savea file...as it's saving they want to terminate it...thus stop the read. I was doing this: def keepReading(): # return wheth

Re: Printing HTML

2006-01-27 Thread Rene Pijlman
Max <[EMAIL PROTECTED]>: >How can I print (as in laser printer, not the python print statement) >HTML from Python Is the printer attached to your server, or are you printing over the internet? -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatic Logging

2006-01-27 Thread [EMAIL PROTECTED]
Thanks very much. I found a good example of using sys.settrace at http://effbot.org/librarybook/sys.htm Cheers, Davy Mitchell Mood News - BBC News Headlines Auto-Classified as Good, Bad or Neutral. http://www.latedecember.com/sites/moodnews/ -- http://mail.python.org/mailman/listinfo/p

Re: writing large files quickly

2006-01-27 Thread Donn Cave
In article <[EMAIL PROTECTED]>, rbt <[EMAIL PROTECTED]> wrote: > Won't work!? It's absolutely fabulous! I just need something big, quick > and zeros work great. > > How the heck does that make a 400 MB file that fast? It literally takes > a second or two while every other solution takes at leas

Re: Logging into a website using urllib2

2006-01-27 Thread Nainto
You may want to look at using PyCurl. (http://pycurl.sourceforge.net/) It makes it easyer to handle this type of stuff. -- http://mail.python.org/mailman/listinfo/python-list

Re: writing large files quickly

2006-01-27 Thread rbt
Grant Edwards wrote: > On 2006-01-27, rbt <[EMAIL PROTECTED]> wrote: > > >>I've been doing some file system benchmarking. In the process, I need to >>create a large file to copy around to various drives. I'm creating the >>file like this: >> >>fd = file('large_file.bin', 'wb') >>for x in xrange

Printing HTML

2006-01-27 Thread Max
How can I print (as in laser printer, not the python print statement) HTML from Python (actually it doesn't have to be HTML - it's tabular data with some rows/columns highlited). The project currently uses Python 2.4 with wxPython and pywin/winpy (whatever it's called, for MS Access ODBC), so i

Re: writing large files quickly

2006-01-27 Thread rbt
Grant Edwards wrote: > On 2006-01-27, Tim Chase <[EMAIL PROTECTED]> wrote: > fd.write('0') >> >>[cut] >> >>>f = file('large_file.bin','wb') >>>f.seek(40960-1) >>>f.write('\x00') >> >>While a mindblowingly simple/elegant/fast solution (kudos!), the >>OP's file ends up with full of the

Re: writing large files quickly

2006-01-27 Thread Grant Edwards
On 2006-01-27, Tim Chase <[EMAIL PROTECTED]> wrote: >>> fd.write('0') > [cut] >> >> f = file('large_file.bin','wb') >> f.seek(40960-1) >> f.write('\x00') > > While a mindblowingly simple/elegant/fast solution (kudos!), the > OP's file ends up with full of the character zero (ASCII 0x30),

Re: os.path.join - Isn't working

2006-01-27 Thread Gregory Piñero
Wow, sorry I sent that a little too fast. I just had to remove the \\ before the graphics. Thus this did work: os.path.join('C:\\Documents and Settings\\Gregory','graphics\\knight\\been hit e0001.bmp') -Greg On 1/27/06, Gregory Piñero <[EMAIL PROTECTED]> wrote: > Would someone mind explaining

os.path.join - Isn't working

2006-01-27 Thread Gregory Piñero
Would someone mind explaining this seemingly strange behavior of os.path.join to me? [Dbg]>>> os.path.join('C:\\Documents and Settings\\Gregory','\\graphics\\knight\\been hit e0001.bmp') >>'\\graphics\\knight\\been hit e0001.bmp' And what is the right way to reference this path relatively? -- Gr

Re: "Python Drive Name" is the search, what is the question?

2006-01-27 Thread Gregory Piñero
Ok, that's one answer. Maybe I'll make a page of answers which will include this one? > Perhaps they're searching for the official name of the Python DAT tape > drive model. > http://www.datman.com/tbul/dmtb_014.htm > > >and of course what the answer would be? > > The firmware names usually look

Re: writing large files quickly

2006-01-27 Thread Tim Chase
>> fd.write('0') [cut] > > f = file('large_file.bin','wb') > f.seek(40960-1) > f.write('\x00') While a mindblowingly simple/elegant/fast solution (kudos!), the OP's file ends up with full of the character zero (ASCII 0x30), while your solution ends up full of the NUL character (ASCII 0x

Re: How do I dynamically create functions without lambda?

2006-01-27 Thread Kay Schluehr
Russell wrote: > I want my code to be Python 3000 compliant, and hear > that lambda is being eliminated. The problem is that I > want to partially bind an existing function with a value > "foo" that isn't known until run-time: > >someobject.newfunc = lambda x: f(foo, x) > > The reason a nested

We have zipimport, how about dllimport?

2006-01-27 Thread [EMAIL PROTECTED]
I may be on particularly potent crack, but I was wondering whether it would make sense to distribute python code in DLLs so that the memory occupied by the bytecode would be consumed only once even if there were multiple processes using the same bytecode. Or is there another way to accomplish code

Re: writing large files quickly

2006-01-27 Thread casevh
Oops. I did mean fd.write(block) The only limit is available memory. I've used 1MB block sizes when I did read/write tests. I was comparing NFS vs. local disk performance. I know Python can do at least 100MB/sec. -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I dynamically create functions without lambda?

2006-01-27 Thread Paul Rubin
"Russell" <[EMAIL PROTECTED]> writes: > I want my code to be Python 3000 compliant, and hear > that lambda is being eliminated. Nobody knows yet what Python 3000 will change, so relax. -- http://mail.python.org/mailman/listinfo/python-list

Logging into a website using urllib2

2006-01-27 Thread dmbkiwi
I've been using urllib2 to try and automate logging into the google adsense page. I want to download the csv report files, so that I can do some analysis of them. However, I don't really know how web forms work, and the examples on the python.org/doc site aren't really helpful. I've found workin

Re: writing large files quickly

2006-01-27 Thread Grant Edwards
On 2006-01-27, rbt <[EMAIL PROTECTED]> wrote: > I've been doing some file system benchmarking. In the process, I need to > create a large file to copy around to various drives. I'm creating the > file like this: > > fd = file('large_file.bin', 'wb') > for x in xrange(40960): > fd.write(

  1   2   >