Re: regexps with unicode-aware characterclasses?

2005-08-30 Thread Fredrik Lundh
Stefan Rank wrote: > I know that there is a re.U switch that makes \w match all unicode word > characters, but there are no subclasses of that ([[:upper:]] or preferably > \u). unicode character classes are not supported by the current RE engine. it's usually possible to work around this by mat

Re: Python2Html regex question

2005-08-30 Thread Fredrik Lundh
Gerard Flanagan wrote: > Either way, the (c#) source is available for the above formatter and it > looks like it would be straightforward to create a Python formatter by > extending a base class and providing the following three things: > > 1) a list of python keywords import keyword print keywor

Re: Precise timings ?

2005-08-30 Thread Fredrik Lundh
Madhusudan Singh wrote: > time.time() seems to report (using %e to format the o/p) a fixed number of > the order ~1e9. you're confused. time.time() reports the wall time in fractional seconds since the epoch (usually jan 1, 1970). if you take the difference between two calls, you'll find that t

Re: Problem with string -> int conversion ?

2005-08-30 Thread Fredrik Lundh
Madhusudan Singh wrote: > I am working with an application that I designed with the Designer > pyuic > workflow and I get the following error on trying to process the contents > of > a combobox : > > Traceback (most recent call last): > File "measure.py", line 908, in acquiredata >np=self.ge

Re: Python doc problems example: gzip module

2005-08-31 Thread Fredrik Lundh
Peter Maas wrote: > Please feel free to insert this fucking example into the fucking docs. or use the fucking search engine. searching for "python example" and clicking the "I feel lucky" button tends to work quite well. e.g. http://www.google.com/search?q=python+gzip+example&btnI=

Re: strange behaviour of str()

2005-08-31 Thread Fredrik Lundh
Juho Vuori wrote: > str(u'lää') raises UnicodeEncodeError > Is this behaviour sane? Possibly, but not documented at all. str() on a Unicode string attempts to convert the string to an 8-bit string using Python's default encoding, which is ASCII. "ä" is not an ASCII character. if this problem a

Re: change date format

2005-08-31 Thread Fredrik Lundh
Lars Gustäbel wrote: > Not a single occurrence of the f**k word. You're making progress. perhaps, but why is he posting apache questions to the python list? -- http://mail.python.org/mailman/listinfo/python-list

Re: Bicycle Repair Man usability

2005-08-31 Thread Fredrik Lundh
Kay Schluehr wrote: > Instead of writing f(g(h(...))) it is sometimes adaequate to write > > x = h(...) > f(g(x)) > > I use this a lot in particular in C++. Optimzing compilers eliminate > runtime penalties. This is of course different in CPython. if "x" is a local variable, the penality isn't th

Re: Problem with string -> int conversion ?

2005-08-31 Thread Fredrik Lundh
Madhusudan Singh wrote: >> if the callback code is Python, you should be able to add a print >> statement to the line just before the failing "int" call: >> >> print repr(signalrangestr), type(signalrangestr) >> signalrange = int(signalrangestr) >> >> that print statement should be all you

Re: aggdraw for PIL

2005-08-31 Thread Fredrik Lundh
Adam Endicott wrote: > Does anyone know anything about the aggdraw module for PIL? I think I > would like to use it because I need to do some drawing with > semi-transparent pen styles (I'm simulating using a highlighter). It > seems to be working great, but I think I'm running into a memory leak

Re: time.strptime() for different languages

2005-08-31 Thread Fredrik Lundh
Adam Monsen wrote: > No, this doesn't seem to work, and I can't find anything in the > documentation indicating that it should. > > >>> import os > >>> os.getenv('LANG') > 'nl_NL' > >>> import time > >>> time.strptime("10 augustus 2005 om 17:26", "%d %B %Y om %H:%M") > Traceback (most recent call

Re: OpenSource documentation problems

2005-08-31 Thread Fredrik Lundh
Bryan Olson wrote: > [...] > > What additions to that string would you suggest? > > Since "help *is* pydoc.help, or at least...", the call could > show the same thing as help(pydoc.help) >>> import pydoc >>> help is pydoc.help False > or at least inform the user that more of the story is availa

Re: OpenSource documentation problems

2005-08-31 Thread Fredrik Lundh
Bryan Olson wrote: > import pydoc > help is pydoc.help > > > > False > > Say Fredrik, if you're going to proclaim "False" oh, I didn't proclaim anything. Python 2.4 did. let's see what Python 2.2 has to say about this: $ python2.2 Python 2.2.1 (#2, Jul 17 2002, 13:11:01) [GCC 2.96

Re: Python Asynchronous I/O library (pyasynchio) [currently win-only]

2005-09-01 Thread Fredrik Lundh
Vladimir Sukhoy wrote: > This Python library is created to support asynchronous I/O > (Input/Output) operations. Unlike most platform-independent asynch I/O > libraries, pyasynchio is simple. You do not have to know much about > programming and anything about AIO in particular to use pyasynchio. >

Re: To the python-list moderator

2005-09-01 Thread Fredrik Lundh
Terry Hancock wrote: > I got one of these too, recently. Maybe somebody is turning up the > screws to get rid of spam that's been appearing on the list? I've been getting these about once a day lately. at first, I suspected some kind of "you're posting to quickly"-filter with a manual "okay, yo

Re: py to exe: suggestions?

2005-09-01 Thread Fredrik Lundh
Ivan Shevanski wrote: > Not sure if you already got the answer to this lol but since this is one > thing about python i do know how to do, use CXFreeze. Its basicly a > combination of all the programs you have already tryed. Works great for me > =D sorry I dont have a link, just google it. it's

Re: Sockets: code works locally but fails over LAN

2005-09-01 Thread Fredrik Lundh
"n00m" <[EMAIL PROTECTED]> wrote: > PEOPLE, WHY ON THE EARTH IT DOES NOT WORK OVER LAN ??? what happens if you change s1.bind((host, port)) to s1.bind(("", port)) ? -- http://mail.python.org/mailman/listinfo/python-list

Re: OpenSource documentation problems

2005-09-01 Thread Fredrik Lundh
Steve Holden wrote: > I agree that maintaining documentation is a generic problem of the open > source world, but it's a sad fact of life that generally people are > better-motivated to complain about documentation (and almost everything > else) than to help improve it. another problem is that to

Re: Bug in string.find

2005-09-01 Thread Fredrik Lundh
Ron Adam wrote: > The problem with negative index's are that positive index's are zero > based, but negative index's are 1 based. Which leads to a non > symmetrical situations. indices point to the "gap" between items, not to the items themselves. positive indices start from the left end, negat

Re: Error managment question (Trace Backs ?)

2005-09-01 Thread Fredrik Lundh
"vpr" <[EMAIL PROTECTED]> wrote: > This is a noob question, but here goes. I have a class that calls a > function. > However I suspect in python that I can raise it and the class can catch > it ? the "errors and exceptions" chapter in the tutorial might be helpful: http://docs.python.org/tu

Re: Python 2.2.1 DLL extension causes "abnormal program termination"

2005-09-01 Thread Fredrik Lundh
Hugh wrote: > Apologies if this has already been answered in here and I can't find > it, but can anyone help with this problem? > I hope the example code and comments state clearly enough what is > happening, but if not, please ask me for further information. > Thank in advance for any help. > #

Re: OpenSource documentation problems

2005-09-01 Thread Fredrik Lundh
Rocco Moretti wrote: > Something a simple as allowing doc bugs to be submitted from a webform > w/o login would reduce the barrier to contribute. - Increasing the size > of the "About" text wouldn't hurt either. (To be honest, I've never > noticed that text before, and it never occurred to me look

Re: Equivalent for an internal write in Python ?

2005-09-01 Thread Fredrik Lundh
Madhusudan Singh wrote: > I am looking to write a formatted string to a string variable : > > Say I have 1.067e-01, I need to write 106.700 to some string. > > In Fortran 95, this would be accomplished with a : > > character(len=7) :: stringvar > real :: stringval > > ... > > write(stringvar,'(f7.

Re: Bug in string.find

2005-09-02 Thread Fredrik Lundh
Ron Adam wrote: >> indices point to the "gap" between items, not to the items themselves. > > So how do I express a -0? Which should point to the gap after the last > item. that item doesn't exist when you're doing plain indexing, so being able to express -0 would be pointless. when you're doin

Re: Python and file locking - NFS or MySQL?

2005-09-02 Thread Fredrik Lundh
Christopher DeMarco wrote: > 2. open(2) is atomic on a local FS, I've read discussions that imply > that link(2) is atomic over NFS (is it?), so I can link from local > lockfile to remote target atomically. I don't grok this; open(2) + > link(2) + stat(2) == 3 calls on my fingers. HTH is this s

Re: Python and file locking - NFS or MySQL?

2005-09-02 Thread Fredrik Lundh
Fredrik Lundh wrote: > 5) check the number of links to each file > > n = os.stat(tempfile)[3] > m = os.stat(lockfile)[3] aw, forget that. I shouldn't trust google over my own code. here's the correct algorithm: f = open(tempfile, "w") f.clos

Re: is there a better way to check an array?

2005-09-02 Thread Fredrik Lundh
Peter Hansen wrote: > Probably because at one point lists didn't even have the index() method, > and when it was suggested and (I believe) Raymond H. added it the list "index" method has been in Python since, like, forever (early 1991, according to CVS, which means that it was added about two yea

Re: To the python-list moderator

2005-09-02 Thread Fredrik Lundh
Terry Reedy wrote: >> What's >> happening is that Spambayes is marking the message as UNSURE. The >> message that mailman sends to the sender is unfortunate. The >> "Message has a suspicious header" notice is misleading because the >> user did not have any header in their message that caused it

Re: python logo

2005-09-03 Thread Fredrik Lundh
Tim Churches wrote: > PPS Emerson's assertion might well apply not just to Python logos, but > also, ahem, to certain aspects of the Python standard library. you've read the python style guide, I presume? http://www.python.org/peps/pep-0008.html -- http://mail.python.org/mailman/listi

Re: embedding python in C, working but with exception at the end

2005-09-03 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Program crashes at line Py_Finalize(). Program tries to read some >memory location and suffer run time exception. PyTuple_SetItem "steals" a reference, so changing Py_XDECREF(stringarg); Py_XDECREF(args); to just Py_XDECREF(args); might fix the problem.

Re: warning when doubly liked list is defined globally

2005-09-05 Thread Fredrik Lundh
"chand" <[EMAIL PROTECTED]> wrote: > In my api.py file 'g_opt_list' is defined globally > g_opt_list =[[],[],[],[],[],[],[]] > > when I run the py file, I am getting the Following Error > > SyntaxWarning: name 'g_opt_list' is used prior to global declaration > > Please let me know how to remove th

Re: python logo

2005-09-05 Thread Fredrik Lundh
Tim Churches wrote: >>> also, ahem, to certain aspects of the Python standard library. >> >> you've read the python style guide, I presume? >> >> http://www.python.org/peps/pep-0008.html > > A Foolish Consistency is the Hobgoblin of Little Minds. > --often ascribed to Ralph Waldo Emerson b

Re: error when parsing xml

2005-09-05 Thread Fredrik Lundh
Odd-R. wrote: > I use xml.dom.minidom to parse some xml, but when input < contains some specific caracters(æ, ø and å), I get an > UnicodeEncodeError, like this: > > UnicodeEncodeError: 'ascii' codec can't encode character > u'\xe6' in position 604: ordinal not in range(128). > > How can I avoid t

Re: error when parsing xml

2005-09-05 Thread Fredrik Lundh
Odd-R. wrote: > This is retrieved through a webservice and stored in a variable test > > > > > ]> > æøå > > printing this out yields no problems, so the trouble seems to be when > executing < the following: > > doc = minidom.parseString(test) unless we have a cut-and-paste problem here, that

Re: Possible improvement to slice opperations.

2005-09-05 Thread Fredrik Lundh
Steve Holden wrote: > Yes, I've been surprised how this thread has gone on and on. it's of course a variation of "You can lead an idiot to idioms, but you can't make him think ;-)" as long as you have people that insist that their original misunderstandings are the only correct way to m

Re: Getting the bytes or percent uploaded/downloaded through FTP?

2005-09-05 Thread Fredrik Lundh
Steve Holden wrote: > The only way I can think of to get the size of the file you're about to > download is using the FTP object's .dir() method. If you have the Tools > directory (standard on Windows, with source on other platforms) you can > take a look at the ftpmirror script - a fairly recent

Re: Newbie: Datetime, "Prog. in Win32", and how Python thinks

2005-09-05 Thread Fredrik Lundh
Max Yaffe wrote: > 1) H&R import a module "dates' which has been dropped. They use > sec2asc which is also m.i.a. I assume that the code should be adapted > to use module datetime. Is that correct? the dates.py module is part of the financial modeling toolkit that is described in chapter 6 of

Re: Possible improvement to slice opperations.

2005-09-05 Thread Fredrik Lundh
Ron Adam wrote: > However, I would like the inverse selection of negative strides to be > fixed if possible. If you could explain the current reason why it does > not return the reverse order of the selected range. why? you're not listening anyway. -- http://mail.python.org/mailman/listi

Re: Possible improvement to slice opperations.

2005-09-05 Thread Fredrik Lundh
Bengt Richter wrote: >>as long as you have people that insist that their original misunderstandings >>are the only correct way to model the real world, and that all observed >>inconsistencies in their models are caused by bugs in the real world, you'll >>end up with threads like this. >> > OTOH, I

Re: Python compiled?

2005-09-05 Thread Fredrik Lundh
"billiejoex" wrote: > I know the great advanteges deriving by using interpretation too, I > appreciate it very much (I'm newbie in Python and the > interpeter really helps me out in many situations), but a 'pure' > interpretated language needs obligatorily an interpreter and > (sorry for repea

Re: Python compiled?

2005-09-05 Thread Fredrik Lundh
Grant Edwards wrote: > > distributing DLLs have been a solved problem for at least > > 15-20 years... > > There are days when some poeple might disagree with that. ;) distributing them has never been a problem. installing them in a shared location has always been a problem. (the solution to the

Re: round function problem

2005-09-06 Thread Fredrik Lundh
"mg" wrote: > We try to white scripts with Pyrhon 2.4 for an acoustic simulation and > we wrote these follow lines : > > > c = 340 > i =j=k= 1 > sum_ = 23 > table = [] > freq = round((c/2*(sum_)**0.5),2) > print freq > table.append([freq,(i,j,k)]) > print i,j,k,' freq',freq > for item in table: p

Re: how to convert a PY to a PYC file

2005-09-06 Thread Fredrik Lundh
"Chavez Gutierrez, Freddy" wrote: >I want to distribute a Python application to several computers, but I don't > want they to be able to see the pure python code (the 'py' file). > > Is there a way to generate a 'pyc' file and distribute that only? sure. several ways, actually. see http://

Re: Cleaning strings with Regular Expressions

2005-09-06 Thread Fredrik Lundh
"sheffdog" <[EMAIL PROTECTED]> wrote: > setAttr ".ftn" -type "string" /assets/chars/ >/boya/geo/textures/lod1/ppbhat.tga"; > Can I do this in one line? >>> os.path.basename("/assets/chars/.../lod1/ppbhat.tga") 'ppbhat.tga' -- http://mail.python.org/mailman/listinfo/python-list

Re: Cleaning strings with Regular Expressions

2005-09-06 Thread Fredrik Lundh
"sheffdog" <[EMAIL PROTECTED]> wrote: > Using basename works, but leaves the extra stuff at the end. > Which would have to be removed with another line of code > > I get this--> ppbhat.tga"; if you're trying to parse Maya files, maybe you should start by writing a simple Maya parser, and use

Re: __dict__ of object, Was: Regular Expression IGNORECASE differentfor findall and split?

2005-09-06 Thread Fredrik Lundh
Chris <[EMAIL PROTECTED]> wrote: > but more of a basic question following, I was doing the following before: > > method = 'split' # came from somewhere else of course > result = re.__dict__[method].(REGEX, TXT) > > precompiling the regex > > r = compile(REGEX) > > does give an regex object which h

Re: dict and __cmp__() question

2005-09-07 Thread Fredrik Lundh
"Alex" <[EMAIL PROTECTED]> wrote: > But what are those with double underscore? For instance __cmp__(...)? > > I tried D.cmp('a','b') make that cmp('a', 'b') methods that start and end with "__" are implementation hooks: http://docs.python.org/ref/specialnames.html __cmp__ is used

Re: ~ after script filename?

2005-09-07 Thread Fredrik Lundh
"presentt" <[EMAIL PROTECTED]> wrote: > Huh, no ~ on other files when I edit them, but at least I don't have to > worry about it. Thanks Aldo. according to http://www.gnome.org/projects/gedit/ gedit supports backup files, so to figure out how and when they're created, and how to control th

Re: Reading in external file - error checking and line numbers...

2005-09-07 Thread Fredrik Lundh
Hugh Macdonald wrote: > I'm writing a tool at the moment that reads in an external file (which > can use any Python syntax) > > At the moment, I'm reading the file in using: > > scriptLines = open(baseRippleScript).read() > exec scriptLines > > However, if I raise an exception in my main code, in

Re: determine if os.system() is done

2005-09-07 Thread Fredrik Lundh
Thomas Bellman wrote: > Have you tried reading the manual for the subprocess module? han har försökt, men hans tourette tog överhanden: http://mail.python.org/pipermail/python-list/2005-September/297642.html -- http://mail.python.org/mailman/listinfo/python-list

Re: determine if os.system() is done

2005-09-07 Thread Fredrik Lundh
"Nainto" <[EMAIL PROTECTED]> wrote: > Yeah, I agree. The Python documentation just merey describes what > arguements a function can take not as much how to use the actual > function. yeah, that's a really relevant criticism when we're talking about a module that contains one function and one class

Re: reading the last line of a file

2005-09-08 Thread Fredrik Lundh
Martin Franklin wrote: > Ok, in that case stick to your shell based solution, although 100 > megabytes does not sound that large to me I guess it is relative > to the system you are running on :) (I have over a gig of memory here) since the file is gzipped, you need to read all of it to get the l

Re: Migrate PYD Files

2005-09-08 Thread Fredrik Lundh
David Duerrenmatt wrote: > Is there a way to use old pyd files (Python 1.5.2) with a newer version > of Python without recompiling them? > Because the source code is not available anymore, I'm wondering whether > it's possible or not to change few bytes with a hex editor (version > number?). I'd

Re: reading the last line of a file

2005-09-08 Thread Fredrik Lundh
Fredrik Lundh wrote: > zcat|tail is a LOT faster. and here's the "right way" to use that: from subprocess import Popen, PIPE p1 = Popen(["zcat", filename], stdout=PIPE) p2 = Popen(["tail", "-1"], stdin=p1.stdout, stdout=PIPE) last

Re: Video display, frame rate 640x480 @ 30fps achievable?

2005-09-08 Thread Fredrik Lundh
Peter Hansen wrote: >> I need to develop an application that displays video 640x480 16-bit per >> pixel with 30 fps. >> >> I would prefer to do that with Python (wxPython) but don't have any >> experience whether it is possible to achieve that frame rate and still >> have some resources for other

Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Fredrik Lundh
"Lil" <[EMAIL PROTECTED]> wrote: > It's in the C code mainly because the buffer is an input to the > driver. The driver takes a char* as input and I didn't want to pass a > char* from python -> swig -> C since swig has memory leaks passing > pointers. > Do you think this is a Python issue or

Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Fredrik Lundh
Lil wrote:' >I already double checked my C code. It runs perfectly fine in C without > any errors. So in my python program, I added a pdb.set_trace() > and step through the program and it did not dump. But when i took out > the tracing, the core dump came back. "sigh" so triple-check it. if your

Re: Inconsistent reaction to extend

2005-09-09 Thread Fredrik Lundh
Jerzy Karczmarczuk wrote: > Gurus, before I am tempted to signal this as a bug, perhaps > you might convince me that it should be so. it's not a bug, and nobody should have to convince you about any- thing; despite what you may think from reading certain slicing threads, this mailing list is not

Re: sys.stdout

2005-09-09 Thread Fredrik Lundh
Sébastien Boisgérault wrote: > Thanks for your answer. The execution of your example leads to a > 'aaa' display during 2 secs, before it is erased by the prompt. > > This behavior is standard ? The standard output is not supposed > to *concatenate* the 'aaa' and the '>>>' ? what "python shell" a

Re: sys.stdout

2005-09-09 Thread Fredrik Lundh
> what "python shell" are you using, and what platform are you running > it on? here's what I get on a standard Unix console: > import sys sys.stdout.write("") > >>> sys.stdout.write("\n") > sys.stdout.write("\n") > > >>> btw, what does >>> sy

Re: how to get the return value of a thread?

2005-09-09 Thread Fredrik Lundh
Leo Jay wrote: > i would like to get the return value of all threads > > e.g. > def foo(num): >if num>10: >return 1 >elif num>50: >return 2 >else >return 0 > > > after i invoked > t = thread.start_new_thread(foo,(12,)) > how to get the return value of `foo'? th

Re: Where do .pyc files come from?

2005-09-09 Thread Fredrik Lundh
Ernesto wrote: >I noticed in a python distribution there were 5 python files (.py) and > 5 other files with the same name, but with the extension .pyc . Is > this some kind of compiled version of the .py files. Thanks, http://www.python.org/doc/2.4.1/tut/node8.html#SECTION00812

Re: distutils question

2005-09-09 Thread Fredrik Lundh
Joachim Dahl wrote: > E.g., say I want to compile a project as: > > gcc -Ddef1 -c foo.c -o foo_def1.o > gcc -Ddef2 -c foo.c -o foo_def2.o > gcc foo_def1.o foo_def2.o -o myext_module.o > > How would I do that using distutils? It doesn't seem to be possible with > the normal core.setup method, and d

Re: execute commands and return output

2005-09-10 Thread Fredrik Lundh
"billiejoex" wrote: > Hi all. I'm searching for a portable (working on *nix and win32) function > that executes a system command and encapsulate its > output into a string. > Searching for the web I found this: > > os.popen('command').read() > > It is perfect but when che command return an error

Re: execute commands and return output

2005-09-10 Thread Fredrik Lundh
"billiejoex" wrote: > Moreover it doesn't work always (for exaple: try a 'dir' command). why use os.system("dir") when Python already offers things like os.listdir, os.walk, and glob.glob ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Design Principles

2005-09-10 Thread Fredrik Lundh
"[EMAIL PROTECTED]" wrote: > After all, the fact that Python is not strongly typed and is > interpreted rather than compiled if you think those are facts, you don't understand how Python works. (hint: Python's both strongly typed *and* compiled) > sacrificing programmer producitivity the abili

Re: Predicting Thumbnail Sizes from PIL

2005-09-11 Thread Fredrik Lundh
Roger wrote: > I need to calculate the thumbnail sizes PILL will produce from an image. > In most cases I can divide and round by adding .5, but PIL seems to > round differently on odd sized images. > > For example, I want to reduce an 800x816 image to have a maximum size of > 697. (697/816) * 80

Re: pretty windows installer for py scripts

2005-09-12 Thread Fredrik Lundh
Gregory Piñero wrote: > How do you do this with the disutils module? I'm looking > to make an installer that will install a python library. start here: http://docs.python.org/dist/dist.html if you need more help, grab some libraries from PyPI and look at their setup files. -- http:/

Re: time.strptime intolerant on weekday string length?

2005-09-13 Thread Fredrik Lundh
Robert wrote: >A certain DAV server reports a time stamp as "Tues, 30 Aug 2005 20:48:31" > ( but not "Tue, ..." as usual) > I also don't see how to alter the pattern for strptime to be tolerante for > more long weekday strings? > Any ideas? why bother parsing the day name at all? (just split t

Re: time.strptime intolerant on weekday string length?

2005-09-13 Thread Fredrik Lundh
> why bother parsing the day name at all? (just split the string at the first > command and use strptime on the rest) msg = msg.replace("command", "comma") -- http://mail.python.org/mailman/listinfo/python-list

Re: retrieve data using FTP in Python

2005-09-13 Thread Fredrik Lundh
"swarna pulavarty" wrote: > I am new to this Python group and to Python . I need to retrieve data > from an arbitrary URL and save it to a file. if you have an URL, you can use the urllib module: urllib.urlretrieve(url, filename) > Can anyone tell me how to retrieve "any" data using FTP mod

Re: Unexpected Behavior Iterating over a Mutating Object

2005-09-13 Thread Fredrik Lundh
Dave Hansen wrote: > Again, iterating over an item that is mutating seems like a Bad > Idea(tm) to me. But I was curious: is this the intended behavior, or > does this fall under what C programmers would call 'undefined > behavior.' a C programmer wouldn't have much problem with this, of course,

Re: Where is the document of python-mode.el

2005-09-14 Thread Fredrik Lundh
"JackPhil" <[EMAIL PROTECTED]> wrote: > I searched in the python-mode.el, sf.net, python.org, and found nothing what document? if you want documentation, switching to a python buffer and typing alt-X followed by "describe-mode" works for me (alternatively, press control-H followed by M): ..

Re: What XML lib to use?

2005-09-14 Thread Fredrik Lundh
Edvard Majakari wrote: > Using a SAX / full-compliant DOM parser could be good for learning things, > though. As I said, depends a lot. since there are no *sane* reasons to use SAX or DOM in Python, that's mainly a job security issue... -- http://mail.python.org/mailman/listinfo/python-lis

Re: Python on AIX 4.3.

2005-09-14 Thread Fredrik Lundh
David Gutierrez wrote: > I'm trying to install Python on an aix 4.3.3. but keep on getting a failed > attempt with the following errors. > > ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock ... > Has anyone seen this before. $ more README ... AIX:A complete overhaul of the shared lib

Re: What XML lib to use?

2005-09-14 Thread Fredrik Lundh
Paul Boddie wrote: > For example, PyQt and PyKDE expose various DOMs of the purest > "non-Pythonic" kind; Mozilla exposes DOMs for XML and HTML I didn't see anything about manipulating an application's internal data structures in the original post, but I might have missed some- thing. For stand-

Re: Python Search Engine app

2005-09-14 Thread Fredrik Lundh
Harlin Seritt wrote: > Is anyone aware of an available open-source/free search engine app > (something similar to HTDig) written in Python that is out there? > Googling has turned up nothing. Thought maybe I'd mine some of you > guys' minds on this. http://divmod.org/ has a couple of alternatives

Re: What XML lib to use?

2005-09-14 Thread Fredrik Lundh
Paul Boddie wrote: >> For stand-alone XML manipulation in Python, my point still stands: >> programs using DOM and SAX are more bloated and slower than >> the alternatives. > > Your point was that "there are no *sane* reasons to use SAX or DOM in > Python", which actually isn't true. I replied in

Re: What XML lib to use?

2005-09-14 Thread Fredrik Lundh
Robert Kern wrote: > His interpretation of your words is a perfectly valid one even in the > context of this thread. "in Python" explicitly provides a context for > the rest of the sentence. Exactly. "in Python", not "in an application with an existing API". (also, if the OP had been forced to

Re: Hello everything

2005-09-14 Thread Fredrik Lundh
David Pantoja wrote: > I have an application in tkinter, one button call to another window, > but the position of this window is random, i' whish to ask at the > list, if exist a function to put the window in x position of the > screen, if exist, which function is it?... try w.geometry("%+d%

Re: new in python

2005-09-15 Thread Fredrik Lundh
"blackfox505" <[EMAIL PROTECTED]> wrote: > I'm new in python and I would like to know what is the capabilleties > of this language.Please let me know and how I can make a program in > python exe if you want to know how to make programs in python, start here: http://wiki.python.org/moin/Begin

Re: urllib.open problem

2005-09-15 Thread Fredrik Lundh
Astan Chee wrote: > I have a python script which runs perfectly on my machine. > However a machine that I tested it on gives the following error > message: > > Traceback (most recent call last): > File "whip.py", line 616, in OnRebootRunning > File "whip.py", line 626, in R

Re: Self reordering list in Python

2005-09-15 Thread Fredrik Lundh
Laszlo Zsolt Nagy wrote: > Do you know how to implement a really efficient self reordering list in > Python? (List with a maximum length. When an item is processed, it > becomes the first element in the list.) I would like to use this for > caching of rendered images. did you check the cheeseshop

Re: Creating Pie Chart from Python

2005-09-15 Thread Fredrik Lundh
Thierry Lam wrote: > Let's say I have the following data: > > 500 objects: > -100 are red > -300 are blue > -the rest are green > > Is there some python package which can represent the above information > in a pie chart? on a screen? in a web browser? on a printer? -- http://mail.python.

Re: Creating Pie Chart from Python

2005-09-15 Thread Fredrik Lundh
Thierry Lam wrote: > In a web browser, having a pie chart in some image format will be great. here's a variation of jepler's tkinter example, using aggdraw to do the drawing and PIL to generate the image. tweak as necessary. # http://effbot.org/zone/draw-agg.htm from aggdraw import * # http://

Re: re and escape character

2005-09-16 Thread Fredrik Lundh
Sinan Nalkaya wrote: > thats exactly what i want, how can i use DOTALL, by doing re.compile ? there's always the manual: http://docs.python.org/lib/node114.html compile(pattern[, flags]) Compile a regular expression pattern into a regular expression object, which can be used fo

Re: Rendering HTML

2005-09-16 Thread Fredrik Lundh
Harlin Seritt wrote: >I am looking for a module that will render html to console but > formatted much like one might see with Lynx. Is there such a module > already out there for this? use htmllib+formatter: http://effbot.org/librarybook/formatter.htm -- http://mail.python.org/mailman

Re: multiple replaces

2005-09-16 Thread Fredrik Lundh
Harald Armin Massa wrote: > sth. like > rpdict={"":"%(tree)s","":"%(house)s","%","%%"} > > for key, value in rpdict.iteritems(): >h1=h1.replace(key, value) > > but ... without the garbage, in one command. > > I guess there are very, very, very wise solution for this problem, but > I do not kno

Re: Walking through directories and files

2005-09-16 Thread Fredrik Lundh
Thierry Lam wrote: > I'm trying to use the os.walk() method to search all the directory from > a root directory and display their contents. For example, I want my > output to be like the following: > > > directoryA > stuffs.c > stuffs2.cpp > > directoryB > asd.c > asdf.cpp > > Any ideas how to do

Re: Self reordering list in Python

2005-09-16 Thread Fredrik Lundh
Terry Hancock wrote: > This is actually the use-case for an "LRU cache"="least recently used > cache", which is probably already implemented in Python somewhere (or > even as a fast extension). I'd do a google search for it. reposted, in case there are more people who cannot be bothered to read

Re: Problem with Help when using numarray

2005-09-16 Thread Fredrik Lundh
Colin J. Williams wrote: > With numarray, help gives unhelpful responses: > > import numarray.numarraycore as _n > c= _n.array((1, 2)) > print 'rank Value:', c.rank > print 'c.rank Help:', help(c.rank) c.rank returns a Python integer object. if you pass in an object to help(), help figures out w

Re: How to obtain a 'interactive session' of a script?

2005-09-18 Thread Fredrik Lundh
Bo Peng wrote: > I have a long list of commands in the form of a script and would like to > obtain a log file as if I enter the commands one by one. (The output > will be used in a tutorial.) What would be the best way to do it? Copy > and paste is not acceptable since I make frequent changes tot

Re: How to obtain a 'interactive session' of a script?

2005-09-18 Thread Fredrik Lundh
Bo Peng wrote: >> import code >> >> SCRIPT = [line.rstrip() for line in open("myscript.py")] >> >> script = "" >> prompt = ">>>" >> >> for line in SCRIPT: >> print prompt, line >> script = script + line + "\n" >> co = code.compile_command(script, "", "exec") >> if co: >> #

Re: How does f=open('mytext.txt', 'w+') work?

2005-09-18 Thread Fredrik Lundh
"Alex" wrote: > If I open the file mytext.txt in Notepad I see something that begins > with > > "My name is Bob VwMÚ¸x¶ Ð" > > and goes on for approximately 4082 characters. > > What's happening?? you're moving the file pointer around in a new file, and you're getting junk (from the stdio fil

Re: How to obtain a 'interactive session' of a script?

2005-09-18 Thread Fredrik Lundh
Bo Peng wrote: > This method works fine with only one minor problem. It would stop > (waiting for user input) at help(str) command. I will have to find a way > to feed the program with'q' etc. replacing sys.stdin with something that isn't a TTY will fix this. here's one way to do it: class

Re: Python 2.5 alpha

2005-09-18 Thread Fredrik Lundh
"D Hering" wrote: > I just installed 2.5a0 what part of aahz's "There is no Python 2.5 alpha" did you not understand? > in an alternative directory (make altinstall) which > build and tested out fine. I'm gonna now attempt to compile the module > packages mentioned above. I'll report how it turn

Re: Help installing Python Constraints

2005-09-19 Thread Fredrik Lundh
Levi Self wrote: > Can someone help me figure out how to install Python Constraints on Windows? > I have Python 2.4 it seems to have a standard setup file, which means that you can install in the same way as you'd install any other source kit: 1) unpack the source archive to some temporary direc

Re: threads/sockets quick question.

2005-09-19 Thread Fredrik Lundh
Bryan Olson wrote: > Next, you never create any instances of scanThread. one would think that the "scanThread()" part of scanThread().start() would do exactly that. -- http://mail.python.org/mailman/listinfo/python-list

Re: C#3.0 and lambdas

2005-09-19 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > On Slashdot there is a discussion about the future C#3.0: > http://developers.slashdot.org/developers/05/09/18/0545217.shtml?tid=109&tid=8 > > http://msdn.microsoft.com/vcsharp/future/ "The extensions enable construction of compositional APIs that have equal exp

Re: execfile eats memory

2005-09-19 Thread Fredrik Lundh
Enrique Palomo Jiménez wrote: > The information will be used no more than 3-4 days a > month and install databases is not allowed. > [...] > Someone suggest me the pickle module. I'll try it and it > works, but pickle dumps is slower than writing the file > with pythonic syntax. (26 seconds vs 6)

<    5   6   7   8   9   10   11   12   13   14   >