Collaborate at PyCon
PyCon is not just a conference to hear people present on Python and Python applications. It's also a place to meet and work with colleagues from around the world. Consider the following opportunities for collaboration: - Sprinting A sprint is a multi-day session of intense development organized around extreme programming (XP) ideas such as pair programming. There will be four days, March 19-22, before the regular conference to sprint on a variety of projects. To see what sprints are planned, see: http://www.python.org/moin/PyConDC2005/Sprints If you would like to lead a sprint, feel free to add the sprint to that page. If you want to participate in a sprint, visit a sprint-topic page and add your name to the list of attendees so that we know how many people are coming. If you have a question about the sprints, feel free to drop me a line. - Open Space Open space is a part of PyCon designed to provide opportunities for collaboration. There are two kinds of open space at Pycon, quiet and noisy. There will be a quiet room provided throughout the conference for people to access the network and to quietly hack with others (e.g. pair program). There will also be noisy rooms for people to have discussions or give informal presentations. The noisy rooms will host up to two presentations or discussions at a time. We'll provide the opportunity to sign up for 30-minute time slots. We'll allow sign up for half of the time slots before the conference. There will be a posted schedule with spaces to sign up for the remainder of the time slots during the conference. I'll provide more information on the open space schedule soon, after we finalize the rest of the conference schedule. Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
ZODB 3.2.5 (final) released
I'm pleased to announce the release of ZODB 3.2.5 (final). This corresponds to the ZODB (and ZEO) planned to ship with Zope 2.7.4 (final) this weekend. You can download a source tarball or Windows installer from: http://zope.org/Products/ZODB3.2 This is a pure bugfix release, fixing some relatively minor but longstanding problems. See the news file for details: http://zope.org/Products/ZODB3.2/NEWS ZODB 3.2.5 can be used with Zopes in the 2.7 line, at or after Zope 2.7.3. Note that ZODB 3.2.4 does not support development on Zope 2.8, Zope X3 or Zope 3 (they require the ZODB 3.3 line). -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Re: from __future__ import decorators
Jacek Generowicz [EMAIL PROTECTED] wrote: I have some code, which makes copious use of the @decorator syntax I'm very curious to know what kind of application you are writing in which copious use of the @decorator syntax actually solved a problem productively. -- - Tim Roberts, [EMAIL PROTECTED] Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
New computer
Hey- Check out this great site that is giving away totally FREE Desktop PCs! I've joined and I think you should as well. It's a completely legitimate offer, and this company has already given away $4 million in FREE stuff! All you have to do is join, complete an online offer, and refer friends to do the same. That's it! Here is my referral link. To help me get my Desktop PC, click this exact link to join, or copy and paste it into a browser: http://www.FreeDesktopPC.com/?r=13995904 this is my second free computer. Its awesome. Get it and sell it or use it. Its free. Who cares. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to del item of a list in loop?
skull [EMAIL PROTECTED] writes: Thank you for your replys. lst[:] is did a solution, it makes a copy of list specially for iteration and removes items from the original one. but I still have an other thing to worry about coming with this way: does performance sucks when the list is big enough? It makes a copy operation! here is a faster and 'ugly' solution: lst = [1, 2, 3] i = 0 while i len(lst): if lst[i] == 2: lst.remove(i) else: i += 1 Hi everybody, it is my first post in this newsgroup. I am a newbie for python though I have several years development experience in c++. recently, I was stumped when I tried to del item of a list when iteration. here is the wrong way I did: lst = [1, 2, 3] for i in lst: print i if i == 2: lst.remove(i) the result is: 1 2 as you would see, '3' is missing. this problem is caused by 'lst.remove(i)'. apparently, 'marked-and-sweep' is a solution to deal with this issue. but I think there SHOULD BE more 'wise' trick. I want to get your help. Thanks in advance. - skull -- http://mail.python.org/mailman/listinfo/python-list
Re: Python.org, Website of Satan
Brian Eable wrote: mr_little [EMAIL PROTECTED] writes: Brian Eable wrote: perl -e '$a=194.109.137.226; @a = reverse split /\./, $a; for $i (0..3) { $sum += $a[$i]*(256**$i) } print sum = $sum\n' 226 + 35072 + 7143424 + 3254779904 = 3261958626 http://3261958626/ Which is NOT 666. Comrade, why perl here? :) Huh? Alt.prophecies.nostradamus is ALL ABOUT PERL! And at the end of the age There shall be a mysterious language Filled with punctuation It will connect many things. Are you afraid python? :) I asked you to stop calling me python. Feel free to write a python version if you want to. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to del item of a list in loop?
skull wrote: It makes a copy operation! so? in python, shallow copies are cheap. here is a faster and 'ugly' solution: faster? did you try it, or are you combining a C++ mindset with an urge to do premature optimizations? (hint: it's slower) if you care about performance, you shouldn't use remove, btw. building a new list is more efficient, especially if you use a list comprehension: lst = [i for i in lst if i != 2] (if you have 2.4, try replacing [] with () and see what happens) /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Python.org, Website of Satan
mr_little wrote: Brian Eable wrote: perl -e '$a=194.109.137.226; @a = reverse split /\./, $a; for $i (0..3) { $sum += $a[$i]*(256**$i) } print sum = $sum\n' 226 + 35072 + 7143424 + 3254779904 = 3261958626 http://3261958626/ Which is NOT 666. Comrade, why perl here? :) Are you afraid python? :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Integration with java (Jpype vs. JPE)
Can someone summarize in a nutshell what is the difference between JPype and JPE? -- http://mail.python.org/mailman/listinfo/python-list
Re: Producer/consumer Queue trick
I don't get it. If the consumer and the producer are separate threads, why does the consumer thread block when the producer thread is generating a new board? Or why does it take forever for the producer thread to be pre-empted? Also, I don't understand why the solution works. How does sleeping for .001 seconds right after putting a new board on the queue solve the problem? Evan Simpson wrote: WEBoggle needs a new game board every three minutes. Boards take an unpredictable (much less than 3min, but non-trivial) amount of time to generate. The system is driven by web requests, and I don't want the request that happens to trigger the need for the new board to have to pay the time cost of generating it. I set up a producer thread that does nothing but generate boards and put them into a length-two Queue (blocking). At the rate that boards are pulled from the Queue, it's almost always full, but my poor consumer thread was still being blocked for a long time each time it fetched a board. At this point I realized that q.get() on a full Queue immediately wakes up the producer, which has been blocked waiting to add a board to the Queue. It sets about generating the next board, and the consumer doesn't get to run again until the producer blocks again or is preempted. The solution was simple: have the producer time.sleep(0.001) when q.put(board) returns. -- http://mail.python.org/mailman/listinfo/python-list
How can I get the names of the files in a directory?
Can you guys also help me find a module that looks in a directory and print out the names of the files in there? __ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I get the names of the files in a directory?
Hi, try the 'listdir' function in the 'os' module. Also check the 'walk' function. regards, Satchit Satchidanand Haridas (sharidas at zeomega dot com) ZeOmega (www.zeomega.com) Open Minds' Open Solutions #20,Rajalakshmi Plaza, South End Road, Basavanagudi, Bangalore-560 004, India Sara Fwd wrote: Can you guys also help me find a module that looks in a directory and print out the names of the files in there? __ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I get the names of the files in a directory?
have a look at the glob module Sara Fwd [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 01/15/2005 03:10 PM To python-list@python.org cc Subject How can I get the names of the files in a directory? Can you guys also help me find a module that looks in a directory and print out the names of the files in there? __ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
[perl-python] 20050115, for statement
© # this is an example of for statement © # the % symbol calculates the remainder © # of division. © # the range(m,n) function © # gives a list from m to n-1. © © a = range(1,51) © for x in a: © if x % 2 == 0: © print x, 'even' © © # note that in this example, for goes over a list. © # each time making x the value of the element. © © © # this is similar code in perl © © @a=(1..50); © for $x (@a) { © if ( $x%2 ==0){ © print $x, even\n; © }} © © # PS each daily tip can be run. Just © # copy the python part and save to a © # file and run it as python © # file.py. Try it. © © © Note: this post is from the Perl-Python © a-day mailing list at © http://groups.yahoo.com/group/perl-python/ © to subscribe, send an email to © [EMAIL PROTECTED] if © you are reading it on a web page, © program examples may not run because © groups.google.com changes the post slightly. © © Xah © [EMAIL PROTECTED] © http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Why 'r' mode anyway?
Tim Plays well with others was a strong motivator for Python's Tim design, and that often means playing by others' rules. -- My vote for QOTW... Is it too late to slip it into the Zen of Python? Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: java 5 could like python?
vegetax [EMAIL PROTECTED] wrote: -No naming convention. The speech of it fits in my head is no longer valid when i use a lot of functionality,modules,classes in a large proyect. For example if i remember a function i want ie:get attribute, i dont remember if the module implementer coded it as getAttribute,GetAttribute,get_attribute, then i have to go and check the doc, every time,which is a waste of time. It is indeed unfortunate that the standard library doesn't use a more consistent naming convention. Perhaps in Python-3000 this will get fixed. In the meantime, if I know what I'm looking for, but just can't remember the exact name, I usually find it's pretty quick to pop into an interactive session, create an object, and see what attributes it has with dir(): l = [] dir (l) ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__delslice__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__str__', 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] -Is python library half object oriented? half functional oriented? I can understand that python allows some functional programing components when they are necesary,but there are libraries that totaly ignore object orientation which makes them problematic to use.for example,Whats with the os.path module and files? why do i have to say os.path.getfilesize(f.name) all the time? why cant i say f.size? Why does urlparse returns a tuple of 7 items instead of an URL object? why there isnt an URL object? and so on.. Again, you are correct that things are not as consistent as they might be. The newer bits of the library tend to be more OO than the older bits, and those parts of the library which are thin wrappers around classic unix functions (like much of the os module) tend to be more procedural. Things are not perfect. I think the real message is that while you can certainly find lots of places where there are imperfections and inconsistencies, overall it's a very easy to use system. Java may be much more consistent, but I find I get bogged down in details like re-exporting exceptions, declaring (and casting) variable types. To each their own. -- http://mail.python.org/mailman/listinfo/python-list
Re: java 5 could like python?
In article [EMAIL PROTECTED], vegetax [EMAIL PROTECTED] wrote: . . . For example if i remember a function i want ie:get attribute, i dont remember if the module implementer coded it as getAttribute,GetAttribute,get_attribute, then i have to go and check the doc, every time,which is a waste of time. . . . Are you comfortable using the base interpreter's built-in interactive facilities, such as help()? I strongly urge you to exercise these for at least a few minutes. -- http://mail.python.org/mailman/listinfo/python-list
where can i fins some good pywin32 tutorials?
need somethin to get started with mfc on python -- ionel. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to del item of a list in loop?
Reinhold Birkenfeld wrote: Addition: In Py2.4, I can't find a problem with for i in reversed(lst) Some poking around suggests it's fine - and it avoids copying the list. Don't delete anything earlier in the list than the current element though (which list.remove() will do quite happily when data is duplicated). However, there will still be data movement costs when deleting elements from the middle of the list. In addition, remove() itself has to do a linear search for the value being removed. An off-place solution based on a list comprehension is usually going to be your best performer - it's an O(n) operation, based on the size of the original list. The in-place mechanisms can turn out to be O(n**2) due to worst-case memory movement effects (lists don't allow gaps, so deleting items will usually trigger data movement). I think this is about the best you can do for an in-place version: for i, x in enumerate(reversed(lst)): if x == 2: del lst[-i] The effbot's version is still going to be faster though: lst = [x for x in lst if x != 2] Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list
Re: python to mssql
On Fri, 14 Jan 2005 15:22:44 -0500, Richards Noah (IFR LIT MET) wrote: Robert Brewer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Brane wrote: can someone please give me some info regarding subject http://sourceforge.net/projects/mysql-python Ask a broad question... Robert Brewer Robert, the question was about 'mssql', not 'mysql'. As for mssql, a search on google will give you the following as the first result: http://pymssql.sourceforge.net/ with others on the page that include: http://www.object-craft.com.au/projects/mssql/ http://www.egenix.com/files/python/eGenix-mx-Extensions.html Don't be lazy, Brane. Your first point of reference should _always_ be google. The fact that I'm Feeling Lucky points you to pymssql shows that you didn't do any research before posting here. -Noah well i wonted to hear frome someone who already used it because there is lots of topics about subject anyway thnks for info brane -- http://mail.python.org/mailman/listinfo/python-list
Re: What strategy for random accession of records in massive FASTA file?
On 14 Jan 2005 12:30:57 -0800, Paul Rubin http://[EMAIL PROTECTED] wrote: Mmap lets you treat a disk file as an array, so you can randomly access the bytes in the file without having to do seek operations Cool! Just say a[234]='x' and you've changed byte 234 of the file to the letter x. However.. however.. suppose this element located more or less in the middle of an array occupies more space after changing it, say 2 bytes instead of 1. Will flush() need to rewrite the half of mmaped file just to add that one byte? flush() definitely makes updating less of an issue, I'm just curious about the cost of writing small changes scattered all over the place back to the large file. -- I have come to kick ass, chew bubble gum and do the following: from __future__ import py3k And it doesn't work. -- http://mail.python.org/mailman/listinfo/python-list
Pointer or unique id
Hello, does python have an equivalent to Java: int Object.hashCode() ? TIA -- Nomak -- http://mail.python.org/mailman/listinfo/python-list
Re: How to del item of a list in loop?
On Sat, 15 Jan 2005 15:27:08 -0500, skull [EMAIL PROTECTED] wrote: lst = [1, 2, 3] for i in lst: print i if i == 2: lst.remove(i) the result is: 1 2 As others have suggested, you can use a copy of the list. Alternatively and depending on what you're trying to accomplish (how complicated it is), lst = [i for i in lst if i!=2] might look better. -- Mitja -- http://mail.python.org/mailman/listinfo/python-list
Re: Python.org, Website of Satan
Jane wrote: Lucas Raab [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jane wrote: [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] python.org = 194.109.137.226 194 + 109 + 137 + 226 = 666 What is this website with such a demonic name and IP address? What evils are the programmers who use this language up to? Some people have too much time on their hands... Jane Better get some ointment for that burn!! Huh??? Jane -- http://mail.python.org/mailman/listinfo/python-list
Re: Python.org, Website of Satan
Lucas Raab wrote: Jane wrote: [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] python.org = 194.109.137.226 194 + 109 + 137 + 226 = 666 What is this website with such a demonic name and IP address? What evils are the programmers who use this language up to? Some people have too much time on their hands... Jane Better get some ointment for that burn!! -- http://mail.python.org/mailman/listinfo/python-list
Re: How to del item of a list in loop?
Reinhold Birkenfeld [EMAIL PROTECTED] writes: Quick solution: for i in lst[:] iterates over a copy. Addition: In Py2.4, I can't find a problem with for i in reversed(lst) Any objections? Reinhold I just downloaded py2.4, and made a test using reversed. it sure be no problem, I thought maybe the reversed holded a copy of list, and eventually iterated through the copy. but the truth is not as I thought so: import sys class Test: pass lst = [Test(),Test(),Test()] E1: for i in lst[:]: E2: for i in reversed(lst): print sys.getrefcount(i) ### E1 outputs: 4 4 4 E2 outputs: 3 3 3 It looks that the reversed does not make a copy of list in contrast with lst[:]. so should we regard: reversed is faster than lst[:]? I do not have any idea about why it is. - skull -- http://mail.python.org/mailman/listinfo/python-list
Re: [perl-python] 20050115, for statement
Michael Hoffman wrote: Xah Lee wrote: © a = range(1,51) © for x in a: © if x % 2 == 0: © print x, 'even' Now he's mixing tabs and spaces. Hideous. Are you doing things wrong on purpose? Actually Xah is to be commended, since he's united the Perl and Python camps. Both agree he's a nuisance who is ill-informed about Perl *and* Python ;-) I can only presume it's egocentricity that keeps him cross-posting this nonsense to c.l.py and c.l.pe.misc despite the many deficiencies that have been remarked upon in both newsgroups. fraternal-greetings-to-the-perl-wordl-ly y'rs - steve -- Steve Holden http://www.holdenweb.com/ Python Web Programming http://pydish.holdenweb.com/ Holden Web LLC +1 703 861 4237 +1 800 494 3119 -- http://mail.python.org/mailman/listinfo/python-list
Re: Com port interrupts again
engsol [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: I didn't fully think through my application before posting my question. Async com port routines to handle com port interrups only work well if one has access to the low level operating system. In that case the receive buffer interrupt would cause a jump to an interrupt service routine.. I don't believe that i would not go that route... the operating system provides sync and async methods to access the serial port. it would make sense to use these before hacking the operating system. (also see below) Python provides that capabilty directly. The solution then would be to write a C extention? ctypes can do many things without a C compiler. it's a very nice an valuable extension, but i won't like to encurage to use it for this particular problem. The suggestions offered by respondents to my original post were almost all of a Use threads, and poll as needed flavor. You're right...I need to learn threads as applied to com ports. if you realy want to do async programming, have a look at twisted (http://twistedmatrix.com). it does not only provide async access to the serial port (trough pyserial + some code in twisted) it also delivers some nice utility functions, classes etc, like the reactor, defereds, thread pools (if you can't resist ;-) and many protocol handlers. chris -- Chris [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: hash patent by AltNet; Python is prior art?
GerritM [EMAIL PROTECTED] wrote: How can this type of fundamental knowledge be patented? I am afraid this is again an example of a total failure of the current patent system. As a European citizen, you have a chance to make a difference to software patentability in Europe -- think globally, act locally. The Netherlands are a crucial country in the ongoing battle against software patents. Get active! http://swpat.ffii.org/ -- we have won major battles over the last 4+ years and we'll need to win quite a few more to break the back of this ugly beast forever. A future where the US and other major SW development countries such as India have saddled themselves with this absurdity, and Europe has freed itself of it, is THE best competitive hope to make Europe into the hotbed of software development and IT innovation in the next generation. Personally, I'm neither patriotic nor competitive, so I'd rather look forward to a world entirely free of this blight -- but hey, where I can make a difference is HERE, so, HERE is where I act. Alex -- http://mail.python.org/mailman/listinfo/python-list
Re: java 5 could like python?
On Sat, 15 Jan 2005 15:08:05 GMT, [EMAIL PROTECTED] (Cameron Laird) wrote: In article [EMAIL PROTECTED], vegetax [EMAIL PROTECTED] wrote: . . . For example if i remember a function i want ie:get attribute, i dont remember if the module implementer coded it as getAttribute,GetAttribute,get_attribute, then i have to go and check the doc, every time,which is a waste of time. . . . Are you comfortable using the base interpreter's built-in interactive facilities, such as help()? I strongly urge you to exercise these for at least a few minutes. This triggers a thought: Some are more passive about exploring than others, and think there's nothing to be seen except what's pointed at. Sad for them, but they need help too. One hopes the tutorial stuff will reawaken natural pleasure in finding out neat stuff. After all, they came to the right place :-) But back to my point (it's coming ;-) [1] ... help Type help() for interactive help, or help(object) for help about object. Ok, will do ;-) help(object) Help on class object in module __builtin__: class object | The most base type Taking the 'object' lesson a little too literally, perhaps ;-) help(my_object) Traceback (most recent call last): File stdin, line 1, in ? NameError: name 'my_object' is not defined Ok, why wasn't I told to expect that in the help() intro? Or that that the following might get me further info? help('my_object') no Python documentation found for 'my_object' [1] Ok, here's the idea that triggered this post: What if help(something) didn't immediately give up with that last message? If instead it looked for helpex.py on the path, and invoked helpex(something) if found? That way, people could easily experiment with site-specific help extensions. ISTR a shell in the deep past sometime that would look for a custom extension before giving up with a parsing error, so I'm not inventing anything new (unless I misremember ;-) That's all. A simple hook could also do it, and site.py could hook it on if desired. E.g., def helpex(*a,**kw): return helpex doesn't exist yet, but it was called with %r and %r ;-) %(a, kw) help.helpex = helpex You could get fancy and make that a property or properties of the base help, and have it chain multiple hookings at front or back for priority etc. Maybe we can invent a standard help extension methodology for temporary app stuff as as well as quasi-permanent site-specific stuff. ... just noodling variations on a theme ;-) For reference: help() Welcome to Python 2.4! This is the online help utility. If this is your first time using Python, you should definitely check out the tutorial on the Internet at http://www.python.org/doc/tut/. Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type quit. To get a list of available modules, keywords, or topics, type modules, keywords, or topics. Each module also comes with a one-line summary of what it does; to list the modules whose summaries contain a given word such as spam, type modules spam. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list
Re: deleting from tarfile
Uwe Mayer wrote: Hi, is it possible to delete a file from a tar-archive using the tarfile module? Thanks Uwe It doesn't appear so. A workaround, of course, is to create a new file with the subset of files from the old file: #!/usr/bin/env python import tarfile import os def removeFile(filename, nameToDelete): Remove nameToDelete from tarfile filename. prefix, ext = os.path.splitext(filename) newFilename = '%(prefix)s-modified%(ext)s' % locals() original = tarfile.open(filename) modified = tarfile.open(newFilename, 'w') for info in original.getmembers(): if info.name == nameToDelete: continue extracted = original.extractfile(info) if not extracted: continue modified.addfile(info, extracted) original.close() modified.close() // m -- http://mail.python.org/mailman/listinfo/python-list
ANN: BOTEC 0.3 -- An astrophysical and orbital mechanics calculator
Summary BOTEC is a simple astrophysical and orbital mechanics calculator, including a database of all named Solar System objects. Overview BOTEC is intended as a simple but useful calculator to assist with making astrophysical, orbital mechanics, and space navigation calculations. As the origin of the acronym applies, BOTEC is more of a back-of-the-envelope calculator rather than an industrial-strength calculator, although this may change in the future. BOTEC is primarily intended for people familiar with physics and Python, and as such is unlikely to be useful to the average enduser. BOTEC really consists of two parts: The BOTEC software, which knows what to do with the data, and the Solar System data itself, which is represented in a large data file (a Python pickle, actually). This is deliberately modularized so that the Solar System data BOTEC uses can be updated independently of thet software, and also that alternative data files (*e.g.*, hypothetical stellar systems for fictional purposes) can be supported. All values are strictly in SI units. Getting the software The current version of botec is 0.3. The latest version of the software is available in a tarball here: http://www.alcyone.com/software/botec/botec-latest.tar.gz. The official URL for this Web site is http://www.alcyone.com/software/botec/. Requirements BOTEC requires Python 2.3 or greater. In its present state, BOTEC will also not be of much use to endusers not familiar with Python, or people without some basic working knowledge of physics, astrophysics, orbital mechanics, and space navigation. License This code is released under the GPL. ... Release history [since 0.2] - 0.3, 2005 Jan 15. Separate transfers from maneuvers; support Oberth maneuvers. - 0.2.1, 2005 Jan 8. Various collected modifications. -- Erik Max Francis [EMAIL PROTECTED] http://www.alcyone.com/max/ San Jose, CA, USA 37 20 N 121 53 W AIM erikmaxfrancis The quickest way of ending a war is to lose it. -- George Orwell -- http://mail.python.org/mailman/listinfo/python-list
Re: How to del item of a list in loop?
Fredrik Lundh wrote: lst = [i for i in lst if i != 2] (if you have 2.4, try replacing [] with () and see what happens) The result is a generator with a name (lst) that's rather misleading in the context. Achieving the same result as the list comprehension, by doing lst = list(i for ... etc etc), appears to be slower. -- http://mail.python.org/mailman/listinfo/python-list
video analysis with python
Hi, I need to write a video analysis tool which extracts statistics from microsocope video. Essentially what I need is to translate the video data into numerical matrices. I have been using Python for the past 1.5 years anytime I could for absolutely everything, because it has every library imaginable... Alas, I can not find a library for decoding video/using codecs. The only solution I have been able to come up with is to create an image sequence and load those in with PIL, however this is not really feasible as the images are too large (nor is it proffessional). Is there a library or project that I have missed, or is there a way to incorporate something like vfw.lib directly? If there isn't I think this would be a pretty large whole in Python's arsenal. Thanks in advance for any help. -- Ashot Petrosian University of Texas at Austin, Computer Sciences -- http://mail.python.org/mailman/listinfo/python-list
Re: How to del item of a list in loop?
Nick Coghlan wrote: I think this is about the best you can do for an in-place version: for i, x in enumerate(reversed(lst)): if x == 2: del lst[-i] I think del lst[-i-1] might be functionally better. -- http://mail.python.org/mailman/listinfo/python-list
Re: python mode indentation problem
© ok, here's the ordeal. © © for i in range(5): © print i © for i in range(2): © print i, 'tt' © for i in [3]: © print i © for i in [32]: © print i © © # 1 level, 4 space © # 2 level, 1 tab © # 3 level, 1 tab, 4 spaces © # 4 level, 2 tabs. © © who the fuck coded the python mode in emacs? fuckhead please peruse: © http://xahlee.org/UnixResource_dir/writ/responsible_license.html © © PS Thanks for the tip on (setq-default indent-tabs-mode nil). © © Xah © [EMAIL PROTECTED] © http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list
nntplib: abstraction of threads
For a particular application of mine, I need to get the messages from usenet , (and group them by each thread) . My startup python code looks as follows. --- Startup code to read messages from a newsgroup -- import nntplib, cStringIO, rfc822, sys SRVR = 'my_news_server' # Your news server newsgroup = 'comp.lang.c' # Group of your choice def inpdflt(s, d): resp = raw_input(%s [%s]: % (s, d)) return resp or d news = nntplib.NNTP(SRVR) resp, estimate, first, last, name = news.group(newsgroup) if estimate == '0': sys.exit(No messages in + newsgroup) # # Get (article number, subject, poster, date, id, references, size, lines) # for each of the articles between first and last # xover = news.xover(first, last) # loop through articles, extracting headers for x in xover[1]: # x == (article number, subject, poster, date, id, references, size, lines) try: hdrs = news.head(x[0])[3] mesg = rfc822.Message(cStringIO.StringIO(\r\n.join(hdrs))) print '%s\n+++%s' % (mesg.getheader(from), mesg.getheader(subject)) except nntplib.NNTPError: pass news.quit() -- End newsgroup -- I am getting all the messages of the newsgroup stored in the newsgroup server. What I want is to *group the messages belonging to each thread* . How would I do that ? Eg: Topic 1 | -- Re: Topic:1 -- Re: Topic: 1 | -- Re: Re: Topic 1 Topic 2 | -- Re: Topic:2 Total number of messages 6, but number of threads = 2, I want to get an abstraction something similar to this. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to del item of a list in loop?
Michael Hoffman wrote: John Machin wrote: Three significant figures is plenty. Showing just the minimum of the results might be better. It might be, but how much time do you want to spend on getting your results for a benchmark that will be run once in the better format? About the same time as the worse format. The Mona Lisa was painted once. The Taj Mahal was built once. Next time you can run the benchmark yourself and it will be in exactly the format you want. I've done that already. I've taken your code and improved it along the suggested lines, added timing for first, middle, and last elements, added several more methods, and added a testing facility as well. Would you like a copy? -- http://mail.python.org/mailman/listinfo/python-list
Re: python mode indentation problem
Xah Lee wrote: [...] © © who the fuck coded the python mode in emacs? fuckhead please peruse: © http://xahlee.org/UnixResource_dir/writ/responsible_license.html © Pure egotism. Not to mention bad language. regards Steve -- Steve Holden http://www.holdenweb.com/ Python Web Programming http://pydish.holdenweb.com/ Holden Web LLC +1 703 861 4237 +1 800 494 3119 -- http://mail.python.org/mailman/listinfo/python-list
Re: python mode indentation problem
[Xah Lee] ... © who the fuck coded the python mode in emacs? The major contributors are listed at the top of python-mode.el. fuckhead please peruse: © http://xahlee.org/UnixResource_dir/writ/responsible_license.html OK, I read it, but have no idea what point you're trying to make here. If, for example, you want to re-release it under a license saying you take financial responsibility for any behavior a user dislikes, be my guest. -- http://mail.python.org/mailman/listinfo/python-list
Re: threading and sockets ?
On Sun, 16 Jan 2005 05:30:37 +0200, ionel wrote: how to make a efficient server.. please point me to some good and clear examples Your question is too broad. There is no such thing as a server, the server must *do* something and it is generally named for what it does.. Please read http://www.catb.org/~esr/faqs/smart-questions.html and try again. That said, Twisted is a likely good first stop. http://twistedmatrix.com/ But I have no way of knowing that, only a guess. -- http://mail.python.org/mailman/listinfo/python-list
[ python-Bugs-699816 ] Canvas Widget origin is off-screen
Bugs item #699816, was opened at 2003-03-08 03:21 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=699816group_id=5470 Category: Tkinter Group: Python 2.2.2 Status: Open Resolution: None Priority: 5 Submitted By: Roy Keir (newbieroy) Assigned to: Nobody/Anonymous (nobody) Summary: Canvas Widget origin is off-screen Initial Comment: I'm a Python newbie, so be patient. I noticed that create-lt;itemgt; didn't place the item where I expected. My [EMAIL PROTECTED] guru Matt Cowles suggested that highlightthickness (hT hereinafter) might be the culprit. I wasn't using hT, but I was using borderwidth (bd to all), and I eventually found the problem. I believe that it is an error in Tkinter, but I'll be happy to be corrected. I wrote a program to display the canvases with the four combinations of hT and bd, and later I doubled up to see if 'relief' with bd==0 had any effect. I'll try to upload the code (oops. It invoves two modules. I may have to send two messages, one with each module). Here is what I think happens, and what I think should happen : DOES: SHOULD: Tkinter finds screen coordinates cx, cy of Canvas same (crucial step omitted) tx, ty = cx, cy Tkinter translatescx, cy = cx - bd, cy -bd tx, ty = tx- bd, ty - bd Tkinter draws the border (width is 2*bd wider than the Canvas)draws the border Tkinter translatescx, cy = cx - hT, cy - hT tx, ty = tx - hT, ty - hT Tkinter draws the highlight box (width is 2*hT wider than the border)draws the hightlight box Tkinter delivers cx, cy as the origin of the Canvas delivers cx, cy as the origin The attached program, if it arrives, demonstrates this effect. Any one doing serious graphics will need to adjust the x,y values of every Canvas item they draw. Putting a wrapper around each to .get() the values of hT and bd (and others I haven't discovered yet ?) is feasible but awful. Putting a function at the top of each event callback function to correct the event object x and y is even more awkward. To preserve backwards compatibility, I suggest that Tkinter Canvas items all be given an extra set of x and y values, with distinctive names. The user can put any old values in the current x,y positional spots and use xcorrected = NN, ycorrected=NN to override the stuff in the positional spots. To handle the variable number of x,y pairs in create_polygon(), create_line(), and perhaps other, Tkinter might require that the new values be given in a tuple of pairs or two tuples (x0,x1,x2) amp; (y0,y1,y2) The attached file is TkCoords03.py The next error will include algGrid03.py. Hope you can get them together. Roy Keir newbieroy [EMAIL PROTECTED] -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 09:46 Message: Logged In: YES user_id=752496 There's no file attached... -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 09:46 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=699816group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-702147 ] --without-cxx flag of configure isn't documented.
Bugs item #702147, was opened at 2003-03-12 09:05 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=702147group_id=5470 Category: Documentation Group: Python 2.2.2 Status: Open Resolution: None Priority: 5 Submitted By: J.A. Schonekerl (jschonek2) Assigned to: Nobody/Anonymous (nobody) Summary: --without-cxx flag of configure isn't documented. Initial Comment: Hi, I can't any discription of the --without-cxx for configure. If you do a ./configure --help it simply doesn't show up! And let this be the flag I needed to build python without libstdc++! Best regards, Jan -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 09:53 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- Comment By: Martin v. Löwis (loewis) Date: 2003-03-17 19:14 Message: Logged In: YES user_id=21627 Yes, please attached unified or context diffs to this bug report, preferably using the CVS version of Python (or 2.3a2 if CVS is not possible). -- Comment By: J.A. Schonekerl (jschonek2) Date: 2003-03-17 16:30 Message: Logged In: YES user_id=732192 It becomes clear for me that making a good help for all systems out there is very difficult. But I could create a better ./configure --help output for python that is comon for all systems. And I can create a patch for the README file that explains the libstdc++ dependencies if you are building with GNU C++. Can I simply add a patch for these to the patch list or how does it work? -- Comment By: Martin v. Löwis (loewis) Date: 2003-03-17 15:39 Message: Logged In: YES user_id=21627 Being a C++ expert won't help you in explaining libstdc++ dependencies: This is specific to GNU C++, not to C++ in general. So you need to be an expert of your operating system; to some degree, this is expected from somebody building software on a system. I *think* that configure --help lists not the defaults, but the non-defaults in most cases, i.e. the options that you need to pass. In some cases (e.g. --with-cxx=), they are not really booleans, but, if activated, also support a parameter (the name of the C++ compiler, for --with-cxx). In that case, the default is more involved: If not specified, --with-cxx is assumed if a C++ compiler can be found and if linking with that C++ compiler is necessary on your system (some systems support C++ extension but don't require Python to be linked with the C++ compiler). So, please do propose specific wording. I think there is little point in explaining every detail of what exactly the configuration tries in what circumstance; so maybe something general enough that still would have helped you might be appropriate. -- Comment By: J.A. Schonekerl (jschonek2) Date: 2003-03-17 09:24 Message: Logged In: YES user_id=732192 For example.. The postgresql configure help does it better: Optional Packages: --with-PACKAGE[=ARG]use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] It also adds: Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -Llt;lib dirgt; if you have libraries in a nonstandard directory lt;lib dirgt; CPPFLAGSC/C++ preprocessor flags, e.g. -Ilt;include dirgt; if you have headers in a nonstandard directory lt;include dirgt; CPP C preprocessor DOCBOOKSTYLE location of DocBook stylesheets But if all listed quot;oiptional pakagesquot; and quot;optional featuresquot; are the default isn't clear in this configure output either. The Python configure needs a general face-lift. -- Comment By: J.A. Schonekerl (jschonek2) Date: 2003-03-17 08:49 Message: Logged In: YES user_id=732192 For me it wasn't clear why the libstdc++ library was dynamicaly linked into the python interpreter. I could not find the relation between the --with-cxx=lt;compilergt; flag and the libstdc++ library. The README file tells something about the --with-cxx flag. But not that this causes the libstdc++ inclusion (not everyone
[ python-Bugs-716634 ] quot; build_extquot; quot; librariesquot; subcommand not s
Bugs item #716634, was opened at 2003-04-07 06:13 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=716634group_id=5470 Category: Distutils Group: Python 2.2.2 Status: Open Resolution: None Priority: 5 Submitted By: Dieter Maurer (dmaurer) Assigned to: Nobody/Anonymous (nobody) Summary: quot;build_extquot; quot;librariesquot; subcommand not s Initial Comment: The quot;librariesquot; command for quot;build_extquot; is definitely one that should accept multiple libraries. However, this is impossible for both the command line as well as the configuration file. Patch attached. -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 14:46 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=716634group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-718532 ] inspect, class instances and __getattr__
Bugs item #718532, was opened at 2003-04-09 17:01 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=718532group_id=5470 Category: Python Library Group: Python 2.2.2 Status: Open Resolution: None Priority: 5 Submitted By: Stefan Schwarzer (sschwarzer) Assigned to: Raymond Hettinger (rhettinger) Summary: inspect, class instances and __getattr__ Initial Comment: inspect.isclass(class_instance) fails if the corresponding class uses a quot;wildcardquot; implementation of __getattr__. Example: Python 2.2.2 (#1, Nov 13 2002, 22:53:57) [GCC 2.95.4 20020320 [FreeBSD]] on freebsd4 Type quot;helpquot;, quot;copyrightquot;, quot;creditsquot; or quot;licensequot; for more information. gt;gt;gt; import inspect gt;gt;gt; class X: ... def __getattr__(self, name): ... if name == 'foo': ... return 1 ... if name == 'bar': ... return 2 ... else: ... return quot;defaultquot; ... gt;gt;gt; x = X() gt;gt;gt; inspect.isclass(x) 1 The problematic expression in inspect.isclass is hasattr(object, '__bases__') which returns a true value. -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 14:50 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- Comment By: Raymond Hettinger (rhettinger) Date: 2003-04-15 07:40 Message: Logged In: YES user_id=80475 Ping, if this change is made, will isclass() still be able to find extension classes? The addition of the hasattr(object, '__bases__') was made by you in ver 1.11 about two years ago. -- Comment By: Walter Dörwald (doerwalter) Date: 2003-04-15 07:01 Message: Logged In: YES user_id=89016 type(object) in (types.TypeType, types.ClassType) won't work with custom metaclasses. isinstance(object, (type, types.ClassType)) would be better. -- Comment By: Stefan Schwarzer (sschwarzer) Date: 2003-04-15 05:01 Message: Logged In: YES user_id=383516 Hello Raymond, thanks for your reply. In fact, I'm also not sure if it counts as a bug. I also suggested a patch (handle __getattr__ requests for __bases__ with an AttributeError) for for the SF project which causes/d the problem. I think, if there's a better way to decide on quot;class-nessquot; than now, the code in inspect should be changed. Fortunately, it doesn't have to be backward-compatible, because the module is always distributed with a certain interpreter version. -- Comment By: Raymond Hettinger (rhettinger) Date: 2003-04-14 21:36 Message: Logged In: YES user_id=80475 Hmm. I'm not sure that counts as a bug. In an OO language, it's a feature that objects can be made to look like and be substituable for other types. In this case, you've taught your object to be able to fake some classlike behavior (having a __bases__ attribute). OTOH, inspect could have a stronger test for classhood: type(object) in (types.TypeType, types.ClassType) -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=718532group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-728515 ] mmap's resize method resizes the file in win32 but not unix
Bugs item #728515, was opened at 2003-04-27 14:44 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=728515group_id=5470 Category: Extension Modules Group: Python 2.2.2 Status: Open Resolution: None Priority: 5 Submitted By: Myers Carpenter (myers_carpenter) Assigned to: Nobody/Anonymous (nobody) Summary: mmap's resize method resizes the file in win32 but not unix Initial Comment: In the resize method under win32 you have something like this: /* Move to the desired EOF position */ SetFilePointer (self-gt;file_handle, new_size, NULL, FILE_BEGIN); /* Change the size of the file */ SetEndOfFile (self-gt;file_handle); Which resizes the file Under Unix you need to call ftruncate(self-gt;fileno, new_size) before calling remap() to make it do the same thing. -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 14:55 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- Comment By: Martin v. Löwis (loewis) Date: 2003-05-04 09:36 Message: Logged In: YES user_id=21627 Would you like to contribute a patch? Please make sure to include changes to the documentation and test suite. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=728515group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1103023 ] raw_input problem with readline and UTF8
Bugs item #1103023, was opened at 2005-01-15 18:10 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1103023group_id=5470 Category: Python Library Group: Python 2.3 Status: Open Resolution: None Priority: 5 Submitted By: Casey Crabb (airog) Assigned to: Nobody/Anonymous (nobody) Summary: raw_input problem with readline and UTF8 Initial Comment: Backspace doesn't remove all bytes of a multi-byte UTF-8 character. To reproduce the problem: $ export LANG=en_US.UTF-8 $ python Python 2.3.4 (#1, Jun 11 2004, 16:35:29) [GCC 3.3.3 20040412 (Gentoo Linux 3.3.3-r3, ssp-3.3-7, pie-8.5.3)] on linux2 Type help, copyright, credits or license for more information. import readline raw_input() # ä, return ä '\xc3\xa4' raw_input() # ä, backspace, return '\xc3' A small C program does not have the same problem: #include stdlib.h #include stdio.h #include readline/readline.h #include readline/history.h void pprint(const char *s); int main(void) { char *line; for (;;) { line = readline( ); if (!line) break; pprint(line); free(line); } return 0; } void pprint(const char *s) { while (*s) { if (isprint(*s)) putchar(*s); else printf(\x%x, *s 0xff); s++; } putchar('\n'); } -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1103023group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-737202 ] CGIHTTPServer does not handle scripts in sub-dirs
Bugs item #737202, was opened at 2003-05-13 14:54 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=737202group_id=5470 Category: Python Library Group: Python 2.2.2 Status: Open Resolution: None Priority: 5 Submitted By: Hartmut Goebel (htgoebel) Assigned to: Nobody/Anonymous (nobody) Summary: CGIHTTPServer does not handle scripts in sub-dirs Initial Comment: CGIHTTPServer does not handle scripts in sub directoreis correctly: When accessing eg. '/cgi-bin/scripts/bla', CGIHTTPServer returns 404 CGI script is not a plain file ('/cgi-bin/script') This tracked down to CGIHTTPRequestHandler.run_cgi() containing these lines: i = rest.find('/') if i gt;= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script This will move the dir-part of the 'rest' into 'script', but leave the actual filename in 'rest'. The 'scriptname' thus does miss the filename. I assume this should become simply: script, rest = rest, '' scriptname = dir + '/' + script -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 15:42 Message: Logged In: YES user_id=752496 Both bugs are for the same problem, keeping this alive (because it has the patch), closing the other as Duplicate. Regarding the patch, the actual code has something very similar to it, so maybe the bug is already fixed... -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 15:42 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- Comment By: Titus Brown (titus) Date: 2004-12-19 03:20 Message: Logged In: YES user_id=23486 same as bug 778804, assigned to esr. -- Comment By: Hartmut Goebel (htgoebel) Date: 2003-05-23 10:21 Message: Logged In: YES user_id=376953 I rethought this: The reason for this type of split is to make it possible to pass parameters as part of the URL, like Zope does. So the snippet above should be changed to something like this: i = 0 while 1: # get the next path-element out of the url i = rest.find('/', i) if i gt;= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translatepath(scriptname) if os.isdir(scriptname): # if scriptname is a directory, continue quot;walkingquot; the url continue # scriptname is not a directory, stop quot;walkingquot; the url break Patch is included. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=737202group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-751758 ] ftplib.retrbinary fails when called from retrlines callback
Bugs item #751758, was opened at 2003-06-10 03:51 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=751758group_id=5470 Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Christian Long (christianmlong) Assigned to: Nobody/Anonymous (nobody) Summary: ftplib.retrbinary fails when called from retrlines callback Initial Comment: Subject: ftplib.retrbinary() fails when called from inside retrlines() callback function I'm using ftplib to backup files from a Linux server to a Windows 2000 worksation. Client: Windows 2000 Pro ActivePython 2.2.2 Build 224 (ActiveState Corp.) based on Python 2.2.2 (#37, Nov 26 2002, 10:24:37) [MSC 32 bit (Intel)] on win32 Komodo IDE Server: ProFTP server (ProFTPd version 1.25) Mandrake Linux 9.0 Summary: When I use it like this it works fine. # Build a list of files that are on the remote server f.retrlines('NLST', makeListOfFiles) --then-- # Iterate over the list, retrieving each file for remoteFileName in listOfFiles: --snip-- f.retrbinary('RETR %s' % remoteFileName, localFile.write) --snip-- But it fails if I try to do the retrieve directly in my callback function. def transferFile(listLine): --snip-- f.retrbinary('RETR %s' % remoteFileName, localFile.write) lt;--fails here on first time through --snip-- # get list of files from server, adn transfer each file as it gets listed f.retrlines('LIST', transferFile) --snip-- File quot;D:\My Documents\Computer World\Python Resources\My Utilities\backup_remote_files.pyquot;, line 45, in ? f.retrlines('LIST', transferFile) File quot;C:\Python22\lib\ftplib.pyquot;, line 413, in retrlines callback(line) File quot;D:\My Documents\Computer World\Python Resources\My Utilities\backup_remote_files.pyquot;, line 36, in transferFile f.retrbinary('RETR mra.py', localFile.write) --snip-- File quot;C:\Python22\lib\ftplib.pyquot;, line 300, in makepasv host, port = parse227(self.sendcmd('PASV')) File quot;C:\Python22\lib\ftplib.pyquot;, line 572, in parse227 raise error_reply, resp error_reply: 200 Type set to I. It looks like the server is returning a 200 instead of a 227 when retrbinary() is called inside a callback function for retrlines(). Files: 2 Files are included: a broken version and a version that works This One Is Broken - retrbinary() called from inside a callback function for retrlines(). === import ftplib import os import time REMOTE_DIR = quot;/home/mydirquot; LOCAL_DIR = quot;C:\My Documentsquot; TIME_FORMAT = quot;%y%m%dquot;# YYMMDD, like 030522 def transferFile(listLine): # Strips the file name from a line of a # directory listing, and gets it from the # server. Depends on filenames # with no embedded spaces or extra dots. if listLine.endswith('.py'): #Split file name on the dot splitFileName=remoteFileName.split('.') # Add a timestamp localFileName=quot;%s_%s.%squot; % (splitFileName[0], time.strftime(TIME_FORMAT), splitFileName[1]) # Open a local file for (over)writing, in binary mode. # print os.path.join(LOCAL_DIR,localFileName) localFile=file(os.path.join(LOCAL_DIR,localFileName), 'wb') print remoteFileName print localFile # Execute the FTP retrieve command, calling # the write() function of the local file # for each block retrieved from the FTP server # BUG: This should work, but I get the following traceback f.retrbinary('RETR %s' % remoteFileName, localFile.write)#lt;--- Fails # Here #mra.py #lt;open file 'D:\My Documents\Work\IA\Miller\MRA\Dev\Backup of remote files\mra_030610.py', mode 'wb' at 0x00886B70gt; #Traceback (most recent call last): # File quot;C:\Program Files\ActiveState Komodo 2.3\callkomodo\kdb.pyquot;, line 430, in _do_start #self.kdb.run(code_ob, locals, locals) # File quot;C:\Python22\lib\bdb.pyquot;, line 349, in run #exec cmd in globals, locals # File quot;D:\My Documents\Computer World\Python Resources\My Utilities\backup_remote_files.pyquot;, line 45, in ? #f.retrlines('LIST', transferFile) # File quot;C:\Python22\lib\ftplib.pyquot;, line 413, in retrlines #callback(line) # File quot;D:\My Documents\Computer World\Python Resources\My Utilities\backup_remote_files.pyquot;, line 36, in transferFile #f.retrbinary('RETR mra.py', localFile.write) # File quot;C:\Python22\lib\ftplib.pyquot;, line 385, in retrbinary #conn = self.transfercmd(cmd, rest) # File quot;C:\Python22\lib\ftplib.pyquot;, line 346, in transfercmd #return self.ntransfercmd(cmd, rest)[0] # File
[ python-Bugs-756940 ] can't CNTRL-C when running os.system in a thread
Bugs item #756940, was opened at 2003-06-18 20:52 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=756940group_id=5470 Category: Threads Group: Python 2.2.2 Status: Open Resolution: None Priority: 5 Submitted By: Greg Jones (morngnstar) Assigned to: Nobody/Anonymous (nobody) Summary: can't CNTRL-C when running os.system in a thread Initial Comment: This is related to Bug #756924. When os.system is called in a thread, Control-C is ignored. Steps to reproduce: 1. Download the attached file fibonacci.py. 2. Run python2.2 fibonacci.py. 3. Hit CNTRL-C. fibonacci.py starts a thread that executes fibonacci.py again (but with a flag to prevent this from recursing infinitely). Then it computes and prints the Fibonacci sequence, the slow way. The process executed in the thread redirects this to a file to avoid conflict over stdout. All this is just to give the program something to do while you hit CNTRL-C. Expected, and Python 2.1 behavior: You get a KeyboardInterrupt exception, a stack trace, and the program exits. Actual Python 2.2 behavior: No response. You have to run kill on the process. Maybe this is not a bug, but rather a limitation of Linux, since I understand SIGINT is blocked during the C function 'system'. However, CNTRL-C worked in Python 2.1, and that was nicer. Removing the lines of code described in Bug #756924 also fix this bug. -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 16:23 Message: Logged In: YES user_id=752496 The other bug have a very long discussion about this, and talks about patches to be applied to Py2.4, and the last patch is actually accepted. Maybe this is already fixed, please give it a try. -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 16:23 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- Comment By: Greg Jones (morngnstar) Date: 2003-06-18 23:58 Message: Logged In: YES user_id=554883 OS is Linux. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=756940group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-763190 ] Sudden death with SIGSEGV in RtlEnterCriticalSection
Bugs item #763190, was opened at 2003-06-30 10:34 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=763190group_id=5470 Category: Threads Group: Python 2.2.2 Status: Open Resolution: None Priority: 5 Submitted By: Maria Martinsdotter (dehex) Assigned to: Nobody/Anonymous (nobody) Summary: Sudden death with SIGSEGV in RtlEnterCriticalSection Initial Comment: Environment: Python 2.2.2 win32all-150 Win2000 Server Dell server 2 CPU Pentuim 4 emulating 4 CPU's. Application: Service with many (50-150) threads. Problem: The entire service exits unexepectedly with only a brief reference made by Dr.Watson indicating the Windows equivalent of SIGSEGV in RtlEnterCriticalSection. Side info: Known to have happened once, we believe it may have happened three times in total but the two extra did not leave even a Dr.Watson trace. The known occurrence can be connected to our use of a timer where the action routine restarts the timer. The two extra's occurred at a point in time that connect the problem event to the timer expiration. The application have been used for five months, runnning around the clock. The customer installation currently use five instances of the base software, only configuration differs. It is arbitrary which instance fail. We have no means to trigger the problem. -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 16:40 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- Comment By: Maria Martinsdotter (dehex) Date: 2003-06-30 19:00 Message: Logged In: YES user_id=807857 Apart from what we initially reported, no extensions are used. It is all pure Python and the only part of win32all used is the support for running it as a service. We are aware of the enhancements provided by 2.3 beta but let it suffice to say that the customer is picky. We have not been able to reproduce the problem in our test environment, however the hardware is not as sophisticated. -- Comment By: Neal Norwitz (nnorwitz) Date: 2003-06-30 12:13 Message: Logged In: YES user_id=33168 Are there any other C/Extension modules used which are not from the standard python distribution? Can you make a self contained test case? I encourage you to test with 2.3 beta 2. There were some thread changes which could affect this problem. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=763190group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-774546 ] popen does not like filenames with spaces
Bugs item #774546, was opened at 2003-07-20 09:29 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=774546group_id=5470 Category: Python Library Group: Python 2.2.2 Status: Open Resolution: None Priority: 5 Submitted By: Philippe Fremy (pfremy) Assigned to: Nobody/Anonymous (nobody) Summary: popen does not like filenames with spaces Initial Comment: The argument for the target executable are passed as a string to popen. The problem is that with filenames which contains spaces, the argument breaking routine will fail and create two arguments for one filename. It would be more convenient if one could pass the argument to popen as a list of string. -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 16:46 Message: Logged In: YES user_id=752496 Think that this should be closed with Won't fix specially now that we have the subprocess module. -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 16:46 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- Comment By: Peter Åstrand (astrand) Date: 2003-11-01 13:44 Message: Logged In: YES user_id=344921 popen5 (http://www.lysator.liu.se/~astrand/popen5/) uses a sequence argument instead of a string, and has no problems with whitespace. Also, it supports connecting several subprocesses together (feeding the output from one command into another). -- Comment By: Philippe Fremy (pfremy) Date: 2003-09-01 07:41 Message: Logged In: YES user_id=233844 I was trying to use python as a shell replacement for simple scripts, but I was disapppointed by the poor level of support of python for those things. In my case, the list of files was pulled from a command and passed to another one. I have some suggestions on how to improve python shell scripting capability. Right now, as soon as you want to do something a little bit complicated, like feeding a program (let's say grep) from the output of another program and checking the output and the exit status is quite complicated. For such an interface to be good, it has to provide _very_ easy way to: - read stdout from a command - provide stdin to a command - read exit status of a command. - pipe a command into another one Let's say I want to run the equivalent of find . -name '*.cpp' | grep -i toto My suggested interface to run a simple command would be as following: cmd( quot;findquot;, quot;.quot;, quot;-namequot;, quot;*.cppquot;) This defines a command to be run. To be versatile, this would have to accept although the following format: cmd( [ quot;findquot;, quot;.quot;, quot;-namequot;, quot;*.cppquot; ] ) cmd( quot;findquot;, [ quot;.quot;, quot;-namequot;, quot;*.cppquot; ] ) which are slightly different ways of spawning a command. I think all these three ways have a usage pattern. To actually execute the command, you woud do: cmd( quot;findquot;, quot;.quot;, quot;-namequot;, quot;*.cppquot; ).go() This create an object which has To run it, you just apply the go() method: cmd( quot;findquot;, quot;.quot;, quot;*.cppquot; ).go() This could return a tuple (stdout, stderr, return_code) Now, if you want to pipe a command into another one, we can either override the operator | or write it manually. My initial command would become: cmd( quot;findquot;, quot;.quot;, quot;-namequot;, quot;*.cppquot; ).pipe().cmd( quot;grepquot;, quot;-iquot;, quot;totoquot; ) I dislike using a syntax like cmd().pipe( cmd ) because piping multiple commands would required parenthesis nesting which does not look nice. The goal is to reach the simplicity of shell scripting. To execute the previous command, one would simple again use the go() method: (stdout, stderr, ret_status) = cmd( quot;findquot;, quot;.quot;, quot;-namequot;, quot;*.cppquot; ).pipe().cmd( quot;grepquot;, quot;-iquot;, quot;totoquot; ).go() Here for my suggestion. It might be more appropriate to post it to a mailing list, to get more feedback ? I am sorry, I am very busy now and won't have time to implement this myself. -- Comment By: Andrew Gaul (gaul) Date: 2003-08-19 09:17 Message: Logged In: YES user_id=139865 Yes, it works. This is also the same behaviour as os.system. os.popen2 allows one to pass either a
[ python-Bugs-794291 ] double symlinking corrupts sys.path[0]
Bugs item #794291, was opened at 2003-08-24 16:52 Message generated for change (Settings changed) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=794291group_id=5470 Category: Python Interpreter Core Group: Python 2.2.2 Status: Closed Resolution: Fixed Priority: 5 Submitted By: Csaba Henk (dzsekijo) Assigned to: Nobody/Anonymous (nobody) Summary: double symlinking corrupts sys.path[0] Initial Comment: The bug can be demonstrated as follows (In some Bourne-tpye Unix shell) type $ mkdir d1 d2 amp;amp; echo 'import sys print sys.path[0]' gt; d1/script.py amp;amp; ln -s ../d1/script.py d2 amp;amp; ln -s d2/script.py . Now see what the three invocations of script.py give us: $ python d1/script.py d1 $ python d2/script.py d2/../d1 $ python script.py d2 -- if script.py imported modules residing in d1, at the third invocation the modules would not be found. -- Comment By: Steven Taschuk (staschuk) Date: 2003-08-28 02:39 Message: Logged In: YES user_id=666873 I confirm this behaviour on Linux 2.4.17 (glibc 2.2.4) with Python 2.2.2 and 2.2.3; but not with Python 2.3. The relevant change seems to be revision 2.114 of Python/sysmodule.c, which implemented SF patch #664376 (q.v.). The change appeared in 2.3a2. Should this be backported to the 2.2 line? -- Comment By: Csaba Henk (dzsekijo) Date: 2003-08-27 12:29 Message: Logged In: YES user_id=754125 I hope the startup message is exact enough: Python 2.2.2 (#1, May 19 2003, 03:15:27) [GCC 3.1] on linux2 -- Comment By: Christos Georgiou (tzot) Date: 2003-08-27 08:46 Message: Logged In: YES user_id=539787 My mistake, I missed the Pyhton 2.2.2 part, sorry. -- Comment By: Christos Georgiou (tzot) Date: 2003-08-27 08:45 Message: Logged In: YES user_id=539787 Which version of Python? With a recent 2.4 (built on Aug 21, sources of Aug 20), on a 2.4.19 SMP kernel: $ mkdir d1 d2 $ echo 'import sys gt; print sys.path[0]' gt;d1/script.py $ ln -s ../d1/script.py d2 $ ln -s d2/script.py . $ python d1/script.py /tmp/tzot/d1 $ python d2/script.py /tmp/tzot/d1 $ python script.py /tmp/tzot/d1 Please specify OS too. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=794291group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-701836 ] Thread running (os.system or popen#)
Bugs item #701836, was opened at 2003-03-11 18:46 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=701836group_id=5470 Category: Python Interpreter Core Group: Python 2.2.2 Status: Open Resolution: None Priority: 5 Submitted By: Johan Fredrik Öhman (johanfo) Assigned to: Nobody/Anonymous (nobody) Summary: Thread running (os.system or popen#) Initial Comment: Bottom line: Some programs may lock up when spawned from a thread. gt;gt;gt; import thread, os gt;gt;gt; thread.start_new_thread(os.system, (quot;/usr/sbin/ntpdate ifi.uio.noquot;,)) This starts a program quot;ntpdatequot; from a Python thread. Usually this is no problem. Ntpdate, is a simple program to adjust the clock of the system. However, when ntpdate is started from a thread it locks up and newer exits!! With my limited debugging knowledge, it sems as it hangs in a quot;poll()quot; kernel call, however, this could be misleading. (I used stacktrace -p lt;pidgt;) -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 17:34 Message: Logged In: YES user_id=752496 Works ok for me: Python 2.3.4 (#1, Oct 26 2004, 16:42:40) [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2 Type help, copyright, credits or license for more information. import thread, os thread.start_new_thread(os.system,(/usr/sbin/ntpdate ifi.uio.no,)) -1210684496 -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 17:34 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- Comment By: Johan Fredrik Öhman (johanfo) Date: 2003-03-12 13:12 Message: Logged In: YES user_id=556425 I have verified this bug on both Redhat 8.0 and SuSE 8.1, linux yes. Signal is one possible path, filedescriptors another. I read somwhere that there was some issues with pthreads forking and filedescriptors. However, this is not my area (too low level) -- Comment By: Michael Hudson (mwh) Date: 2003-03-12 09:40 Message: Logged In: YES user_id=6656 IIRC, threads other than the main thread get a signal mask that blocks everything. That could be the problem, but I don't know what to do about it... What platform are you on? Linux? -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=701836group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-768649 ] popen4 doesn't close filedescriptors when in Threads
Bugs item #768649, was opened at 2003-07-09 15:36 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=768649group_id=5470 Category: Python Library Group: Python 2.2.2 Status: Open Resolution: None Priority: 5 Submitted By: martin doudoroff (mdoudoroff) Assigned to: Nobody/Anonymous (nobody) Summary: popen4 doesn't close filedescriptors when in Threads Initial Comment: Running the following code under Linux will result in a crash on the 508th thread started. The error is OSError: [Errno 24] Too many open files The nature of the bug seems to be that Python isn't closing filedescriptors cleanly when running a thread. --- import os from threading import Thread class Crash(Thread): def run(self): a = os.popen4('ls') b = a[1].read() # uncommenting these lines fixes the problem # but this isn't really documented as far as # we can tell... # a[0].close() # a[1].close() for i in range(1000): t = Crash() t.start() while t.isAlive(): pass print i --- The same code without threads (Crash as a plain class) doesn't crash, so the descriptor must be getting taken care of when the run() method is exited. import os class Crash: def run(self): a = os.popen4('ls') b = a[1].read() for i in range(1000): t = Crash() t.run() print i -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 17:48 Message: Logged In: YES user_id=752496 Works fine to me: Python 2.3.4 (#1, Oct 26 2004, 16:42:40) [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2 with glibc-2.3.4-2 -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 17:48 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- Comment By: Andrew Gaul (gaul) Date: 2003-10-01 15:51 Message: Logged In: YES user_id=139865 Duplicated with Python 2.3 on Red Hat 7.3 using glibc-2.2.5-43. Popen3.{poll,wait} are written under the incorrect assumption that waitpid can monitor any process in the same process group, when it only works for immediate children. _active.remove is never called, so Popen3 objects are never destroyed and the associated file descriptors are not returned to the operating system. A general solution for Popen[34] is not obvious to me. With patch #816059, popen2.popen[234] plugs the _active leak, which in turn returns the file descriptors to the operating system when the file objects that popen2.popen[234] return go out of scope. -- Comment By: Neal Norwitz (nnorwitz) Date: 2003-07-10 00:20 Message: Logged In: YES user_id=33168 I can't duplicate this on Redhat 9. What OS, what version of glibc and what kernel are you using? Does it always crash on the 508th iteration? I tested with both 2.2.3 and 2.3b2 from CVS without problems. I even used ulimit to set my open files to 10. Can you try the patch in bug #761888 to see if that helps? http://pythong.org/sf/761888 -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=768649group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-771429 ] Signals discard one level of exception handling
Bugs item #771429, was opened at 2003-07-15 03:57 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=771429group_id=5470 Category: Python Interpreter Core Group: Python 2.1.2 Status: Open Resolution: None Priority: 5 Submitted By: Dieter Maurer (dmaurer) Assigned to: Nobody/Anonymous (nobody) Summary: Signals discard one level of exception handling Initial Comment: Signals handled by Python (especially KeyboardInterrupt) may discard one level of exception handling. Consider the following code fragment: try: # outer exception handling level try: # inner exception handling level blocking_external_extension_function() except: print quot;inner exception handlingquot; except: print quot;outer exception handlingquot; Assume that quot;blocking_external_extension_functionquot; is an external function (implemented in quot;Cquot;) that blocks until interrupted by a signal (EINTR) and then returns with an exception but without handling the signal. In our concrete case, quot;blocking_external_extension_functionquot; has been quot;psycopg.connectquot; (the database quot;connectquot; from the Python-PostgreSQL bridge quot;psycopgquot;). In this case, when you interrupt the execution, while quot;blocking_external_extension_functionquot; waits, the quot;KeyboardInterruptquot; is not caught in the inner quot;try: ...except: ...quot; but only in the outer quot;try: ... except: ...quot; The following happens in detail in Python's main interpreter loop: * quot;blocking_external_extension_functionquot; returns with an exception. * Python sets the next instruction to the exception handler of the inner exception handling * Python begins a new run through its main loop. At the start, it detects the quot;KeyboardInterruptquot; signal. It now thinks, the quot;KeyboardInterruptquot; were caused inside the inner exception handler and pops this exception handling level without executing it. The interpreter has lost one level of exception handling. The behaviour would probably better fit with expectations, when the interpreter would check for signals at the end of its main loop and before it sets its instruction pointer to the exception handler. -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 18:26 Message: Logged In: YES user_id=752496 Deprecated. Reopen only if still happens in 2.3 or newer. .Facundo -- Comment By: Michael Hudson (mwh) Date: 2004-11-09 08:33 Message: Logged In: YES user_id=6656 Oh, after some judicious view-sourcing and query-replacing, I get the problem. However, I can't reproduce it (see attached script). So we're back to needing a failing example and more platform details. -- Comment By: Michael Hudson (mwh) Date: 2004-11-09 08:16 Message: Logged In: YES user_id=6656 In addition, attaching any code samples rather than including them would seem a good idea. I can't make head or tail of the code in the summary. -- Comment By: Facundo Batista (facundobatista) Date: 2004-11-08 20:45 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=771429group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-771429 ] Signals discard one level of exception handling
Bugs item #771429, was opened at 2003-07-15 03:57 Message generated for change (Settings changed) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=771429group_id=5470 Category: Python Interpreter Core Group: Python 2.1.2 Status: Closed Resolution: Wont Fix Priority: 5 Submitted By: Dieter Maurer (dmaurer) Assigned to: Nobody/Anonymous (nobody) Summary: Signals discard one level of exception handling Initial Comment: Signals handled by Python (especially KeyboardInterrupt) may discard one level of exception handling. Consider the following code fragment: try: # outer exception handling level try: # inner exception handling level blocking_external_extension_function() except: print quot;inner exception handlingquot; except: print quot;outer exception handlingquot; Assume that quot;blocking_external_extension_functionquot; is an external function (implemented in quot;Cquot;) that blocks until interrupted by a signal (EINTR) and then returns with an exception but without handling the signal. In our concrete case, quot;blocking_external_extension_functionquot; has been quot;psycopg.connectquot; (the database quot;connectquot; from the Python-PostgreSQL bridge quot;psycopgquot;). In this case, when you interrupt the execution, while quot;blocking_external_extension_functionquot; waits, the quot;KeyboardInterruptquot; is not caught in the inner quot;try: ...except: ...quot; but only in the outer quot;try: ... except: ...quot; The following happens in detail in Python's main interpreter loop: * quot;blocking_external_extension_functionquot; returns with an exception. * Python sets the next instruction to the exception handler of the inner exception handling * Python begins a new run through its main loop. At the start, it detects the quot;KeyboardInterruptquot; signal. It now thinks, the quot;KeyboardInterruptquot; were caused inside the inner exception handler and pops this exception handling level without executing it. The interpreter has lost one level of exception handling. The behaviour would probably better fit with expectations, when the interpreter would check for signals at the end of its main loop and before it sets its instruction pointer to the exception handler. -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 18:26 Message: Logged In: YES user_id=752496 Deprecated. Reopen only if still happens in 2.3 or newer. .Facundo -- Comment By: Michael Hudson (mwh) Date: 2004-11-09 08:33 Message: Logged In: YES user_id=6656 Oh, after some judicious view-sourcing and query-replacing, I get the problem. However, I can't reproduce it (see attached script). So we're back to needing a failing example and more platform details. -- Comment By: Michael Hudson (mwh) Date: 2004-11-09 08:16 Message: Logged In: YES user_id=6656 In addition, attaching any code samples rather than including them would seem a good idea. I can't make head or tail of the code in the summary. -- Comment By: Facundo Batista (facundobatista) Date: 2004-11-08 20:45 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=771429group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-629345 ] build does not respect --prefix
Bugs item #629345, was opened at 2002-10-27 04:10 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=629345group_id=5470 Category: Build Group: Python 2.1.2 Status: Closed Resolution: Wont Fix Priority: 5 Submitted By: Philip Brown (theferret) Assigned to: Nobody/Anonymous (nobody) Summary: build does not respect --prefix Initial Comment: I want to compile python with a different prefix. I use configure --prefix=/my/stuf but some things are still hardcoded to look in /usr/local for example, setup.py This stops extensions like bsddb from being built, even though the include files are present in $prefix/include Even if I go the extra mile to do export CPPFLAGS=/my/stuff, and the configure script successfully detects I have db.h... it STILL does not compile bsddb until I make a link from /my/stuff/include/db.h to /usr/local/include/db.h Please fix all those locations that have hardcodes for /usr/local -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 18:32 Message: Logged In: YES user_id=752496 Deprecated. Reopen only if still happens in 2.3 or newer. .Facundo -- Comment By: Facundo Batista (facundobatista) Date: 2004-11-08 20:56 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- Comment By: Philip Brown (theferret) Date: 2002-10-27 22:53 Message: Logged In: YES user_id=7120 Whats wrong with editing Modules/Setup? How about, quot;whats wrong with automating the build process in a standard fashion, instead of forcing builders to jump through unneccessary hoops?quot; Thats what autoconf, etc. is for, after all. LD_LIBRARY_PATH is a standard environment setting, across virtually all modern UNIXen. Most other programs tend to compile a fake program, or some such, to check for existance of a library (like, $CC -o test test.c -ldb, and see if it works) That is a fairly standard autoconf method of checking for libraries, and has the nice side effect of taking advantage of whatever dynamic loading paths the OS happens to use. If you are going to stick with your own methods of probing, you should make those methods as effective as the more common ones. The way to DO that, is to respect LD_LIBRARY_PATH, if it is set. -- Comment By: Martin v. Löwis (loewis) Date: 2002-10-27 16:36 Message: Logged In: YES user_id=21627 What's wrong with editing Modules/Setup? -- Comment By: Philip Brown (theferret) Date: 2002-10-27 16:27 Message: Logged In: YES user_id=7120 When trying to detect whether a library is available, you should at least respect LD_LIBRARY_PATH if it is set, rather than hardcoding stuff like /usr/local reguardless of $prefix -- Comment By: Martin v. Löwis (loewis) Date: 2002-10-27 15:54 Message: Logged In: YES user_id=21627 #--prefix specifies what to put in strings instead of /usr/local. No. See ./configure --help: --prefix=PREFIX install architecture-independent files in PREFIX [/usr/local] -- Comment By: Philip Brown (theferret) Date: 2002-10-27 15:51 Message: Logged In: YES user_id=7120 --prefix specifies what to put in strings instead of /usr/local. It is common practice to install ALL free software under a /usr/local equivalent. eg: /opt/freeware Clearly, /opt/freeware is for ALL freeware, not just for quot;this packagequot;. It is the most consistent to scan whatever was specified for $prefix, rather than to hardcode for /usr/local Additionally, there could conceptually be other stuff in /usr/local that might conflict (which actually happend to me) The whole point of --prefix is to specify a location to use INSTEAD OF /usr/local. If the user/admin explicitly says quot;do not use /usr/local, use this path insteadquot;, you should NOT use /usr/local !! (unless it is in $PATH, $CPPFLAGS, or $LD_LIBRARY_PATH. Which it is not, in my case) -- Comment By: Martin v. Löwis (loewis) Date: 2002-10-27 09:20 Message: Logged In: YES user_id=21627 This is by design. --prefix specifies the places to install *this* package (i.e. python), not the places to look for other packages.
[ python-Bugs-487471 ] urllib2 proxyhandle won't work.
Bugs item #487471, was opened at 2001-11-30 09:54 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=487471group_id=5470 Category: Python Library Group: Python 2.2 Status: Closed Resolution: Wont Fix Priority: 5 Submitted By: Ha Shao (hashao) Assigned to: Jeremy Hylton (jhylton) Summary: urllib2 proxyhandle won't work. Initial Comment: For python 2.2b2: Adding proxyhandler with build_opener, install_opener does not work since order of the handlers does matter (my guess). In the current code, new handlers are appended at the end of the handlers list. At least under windows, the proxyhandle will never got called if it is added with install_opener. HTTPHandler always get called before proxyhandler if the default list is altered. The attached patch try to reserve the order of handlers based on their baseclass when adding new handlers. Handlers with the same baseclasses might be added more than once. Not sure if it is a good thing or bad thing. Current code will raise except when it trys to remove the default handlers twice. Since order does matter, build_opener should be repleased by a list like class such that user can insert their handlers to specific place. -- Comment By: Facundo Batista (facundobatista) Date: 2005-01-15 19:32 Message: Logged In: YES user_id=752496 Deprecated. Reopen only if still happens in 2.3 or newer. .Facundo -- Comment By: Facundo Batista (facundobatista) Date: 2004-11-25 20:58 Message: Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as Won't fix. Thank you! .Facundo -- Comment By: John J Lee (jjlee) Date: 2003-10-30 16:02 Message: Logged In: YES user_id=261020 That last comment was from me (cookie problems, ironically). -- Comment By: Nobody/Anonymous (nobody) Date: 2003-10-30 15:57 Message: Logged In: NO This should be closed. I don't recall which minor version of 2.2 this was introduced at, but there's no need to replace build_opener any more. The most you have to do is to explicitly pass a handler or two to build_opener with appropriately set handler_order attributes. Or you can subclass the handlers. -- Comment By: Micah Stetson (micahs) Date: 2003-05-07 20:29 Message: Logged In: YES user_id=774014 I don't know about Ha Shao, but I have the problem with Python 2.2.2. My work around was to modify urllib2.build_opener to add the user's supplied handlers before the defaults. Shao's idea of a list-like class is probably better. -- Comment By: Neal Norwitz (nnorwitz) Date: 2003-01-13 18:50 Message: Logged In: YES user_id=33168 Ha Shao, I know there were many changes in Python 2.2.x in this area. Do you still have this problem? Can this bug be closed? -- Comment By: Ha Shao (hashao) Date: 2001-11-30 10:10 Message: Logged In: YES user_id=8717 forgot some code and changed a stupid variable name. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=487471group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com