[ANN] Bento 0.0.5, a packaging solution for python software
Hi, I am pleased to announce a new release of bento, a packaging solution for python which aims at reproducibility, extensibility and simplicity. You can take a look at its main features on bento's main documentation page (http://cournape.github.com/Bento). The main features of this 0.0.5 release are: - All python versions from 2.4 up to 3.1 now pass the test suite (3.2 will follow once a distribute issue with 3.2 is fixed) - If run under a virtual environment (virtualenv), bento will install the package inside the virtualenvironment by default - Internal changes to enable easier change of build tool (an example for simple extensions is available for waf 1.6.x) - Added experimental distutils compatibility layer so that one can write a setup.py which will pick up all information from bento.info. This enables projects using bento to be able to use tools such as pip. Bento now has its own mailing list: be...@librelist.com. If you are curious about bento, I will present it at pycon 2011 as a poster. cheers, David -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
pyCologne Python User Group Cologne - Meeting, March 9, 2011, 6.30pm
The next meeting of pyCologne will take place: Wednesday, March, 9th starting about 6.30 pm - 6.45 pm at Room 0.14, Benutzerrechenzentrum (RRZK-B) University of Cologne, Berrenrather Str. 136, 50937 Köln, Germany Any presentations, news, book presentations etc. are welcome on each of our meetings! At about 8.30 pm we will as usual enjoy the rest of the evening in a nearby restaurant. Further information including directions how to get to the location can be found at: http://www.pycologne.de (Sorry, the web-links are in German only.) Best regards, Andi -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: Finding keywords
On Mon, Mar 7, 2011 at 11:18 PM, Cross x...@x.tv wrote: Hello I have got a project in which I have to extract keywords given a URL. I would like to know methods for extraction of keywords. Frequency of occurence is one; but it seems naive. I would prefer something more robust. Please suggest. snip --- news://freenews.netfront.net/ - complaints: n...@netfront.net --- Complaint: This question is not Python-specific in any way. Regards, Chris -- http://mail.python.org/mailman/listinfo/python-list
Re: Finding keywords
On 03/08/2011 01:27 PM, Chris Rebert wrote: Complaint: This question is not Python-specific in any way. Regards, Chris Well Chris, my implementation is in Python. :) That is as much python-specific as it gets. Well the question is general of course and I want to discuss the problem here. --- news://freenews.netfront.net/ - complaints: n...@netfront.net --- -- http://mail.python.org/mailman/listinfo/python-list
Re: ImSim: Image Similarity
On Mon, Mar 7, 2011 at 6:30 AM, n00m n...@narod.ru wrote: Remind me this piece of humor: One man entered a lift cabin at the 1st floor, lift goes to the3rd floor, opens and ... it's empty! Physicist, Chemist and Mathematician were asked: what happened to the man? Physicist: he was squashed to the floor by acceleration! Chemist: he was vaporized by some acid gases! Mathematician: hmm... Let's call a lift *empty* if there is inside of it no more than *1* man. That reminds me of another joke I once heard. A logician, a biologist, and a physicist are watching an empty house. They observe two people going into the house, and then some time later three people emerge. The logician observes, Our premise must have been incorrect. The house was not initially empty. The biologist speculates, Perhaps the two people whom we saw go into the house have reproduced while inside, resulting in the third. Finally, the mathematician concludes, I don't know about that, but I do know that if one more person goes into that house, it will be empty! This has nothing to do with Python, though. -- http://mail.python.org/mailman/listinfo/python-list
Re: Generate PDF with Tamil font problem
On Sat, Mar 5, 2011 at 5:28 PM, Tom Zych freethin...@pobox.com wrote: sathe...@e-ndicus.com wrote: I am using python's reportlab to print some unicode Tamil characters '#2986;#3015;'. I added necessary unicode font to reportlab. But It prints the output as '#3015;#2986;' (in reverse order). This issue happens for multi-byte characters, whereas for character '#2986;' is printed as it is. I am struggling to figure out the issue. Any help would see me on track. http://stackoverflow.com/questions/5166488/ Similar issue. Has anybody fixed/extended this in reportlab ? -- Regards, S.Selvam http://e-ndicus.com/ http://selvam4u.wordpress.com -- http://mail.python.org/mailman/listinfo/python-list
embedded python 2.7.1 slow startup
Hi I've been playing with running python on embedded linux. I thought I would run some straces to see how the install went when I noticed python attempts to open loads of files that don't exist.is there a way to prevent these open attemptsthey're responsible for 40% of my scripts execution time. I was wondering if there is a way to prevent python from attempting to open files I know are not there? Thanks Bruce # strace -ce trace=open ./fib.py 1 1 2 3 5 8 13 21 34 55 89 144 % time seconds usecs/call callserrors syscall -- --- --- - - 100.000.020306 128 159 118 open -- --- --- - - 100.000.020306 159 118 total # strace -fe trace=open ./fib.py open(/dev/urandom, O_RDONLY) = 3 open(/lib/libpthread.so.0, O_RDONLY) = 3 open(/lib/libdl.so.0, O_RDONLY) = 3 open(/lib/libutil.so.0, O_RDONLY) = 3 open(/lib/libm.so.0, O_RDONLY)= 3 open(/lib/libc.so.0, O_RDONLY)= 3 open(/lib/libc.so.0, O_RDONLY)= 3 open(/lib/libc.so.0, O_RDONLY)= 3 open(/lib/libc.so.0, O_RDONLY)= 3 open(/lib/libc.so.0, O_RDONLY)= 3 open(/usr/lib/python2.7/site.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/sitemodule.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/site.py, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/site.pyc, O_RDONLY|O_LARGEFILE) = 3 open(/usr/lib/python2.7/os.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/osmodule.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/os.py, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/os.pyc, O_RDONLY|O_LARGEFILE) = 4 open(/usr/lib/python2.7/posixpath.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/posixpathmodule.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/posixpath.py, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/posixpath.pyc, O_RDONLY|O_LARGEFILE) = 5 open(/usr/lib/python2.7/stat.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/statmodule.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/stat.py, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/stat.pyc, O_RDONLY|O_LARGEFILE) = 6 open(/usr/lib/python2.7/genericpath.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/genericpathmodule.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/genericpath.py, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/genericpath.pyc, O_RDONLY|O_LARGEFILE) = 6 open(/usr/lib/python2.7/warnings.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/warningsmodule.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/warnings.py, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/warnings.pyc, O_RDONLY|O_LARGEFILE) = 6 open(/usr/lib/python2.7/linecache.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/linecachemodule.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/linecache.py, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/linecache.pyc, O_RDONLY|O_LARGEFILE) = 7 open(/usr/lib/python2.7/types.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/typesmodule.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/types.py, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/types.pyc, O_RDONLY|O_LARGEFILE) = 7 open(/usr/lib/python2.7/UserDict.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/UserDictmodule.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/UserDict.py, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/UserDict.pyc, O_RDONLY|O_LARGEFILE) = 5 open(/usr/lib/python2.7/_abcoll.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/_abcollmodule.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/_abcoll.py, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open(/usr/lib/python2.7/_abcoll.pyc, O_RDONLY|O_LARGEFILE) = 6 open(/usr/lib/python2.7/abc.so, O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
Re: Finding keywords
Cross wrote: On 03/08/2011 01:27 PM, Chris Rebert wrote: Well Chris, my implementation is in Python. :) That is as much python-specific as it gets. Well the question is general of course and I want to discuss the problem here. If you have anything written in Python yet and want to present that for discussion, do so. Otherwise, you just look like someone too lazy to do their homework, asking for a solution to a task without having done any preliminary research. Otherwise, in order to find keywords, just search for keywords. Uli -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list
Re: embedded python 2.7.1 slow startup
On Tue, Mar 8, 2011 at 2:36 PM, bruce bushby bruce.bus...@gmail.com wrote: Hi I've been playing with running python on embedded linux. I thought I would run some straces to see how the install went when I noticed python attempts to open loads of files that don't exist.is there a way to prevent these open attemptsthey're responsible for 40% of my scripts execution time. I was wondering if there is a way to prevent python from attempting to open files I know are not there? I had a (sort of) similar problem recently with a python script on an N900 phone, with the startup time completely dominating the total runtime. I simply converted it into daemon instead, which solved the responsiveness problem for me. I wonder if that is applicable for your situation. -- regards, kushal -- http://mail.python.org/mailman/listinfo/python-list
Re: encoding hell - any chance of salvation ?
Thanks for both the suggestions. I haven't yet had time to try them out but will do so and report back. -- http://mail.python.org/mailman/listinfo/python-list
SCM
Hi, I am looking for a Python library, which can handle the modelling of material flows in Supply Chains. Any idea ? Thx -- http://mail.python.org/mailman/listinfo/python-list
Re: SCM
On Tue, Mar 8, 2011 at 3:42 AM, Cliff Scherer cliffsche...@me.com wrote: Hi, I am looking for a Python library, which can handle the modelling of material flows in Supply Chains. Any idea ? Some googling turned up https://sites.google.com/a/logopt.com/www/ If you're doing simulations, GarlicSim might be useful as infrastructure to build upon: http://garlicsim.org/ Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list
Re: SCM
Cliff Scherer, 08.03.2011 12:42: I am looking for a Python library, which can handle the modelling of material flows in Supply Chains. Note that TLAs do not always uniquely identify a subject. SCM is easily read as source code management or software configuration management on a programming related list. There's also a Scheme implementation with that name. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: A question about Cmd Class
On 01/-10/-28163 02:59 PM, yuan zheng wrote: Hello, everyone: I encouter a question when implementing a commmand line(shell). I have implemented some commands, such as start, stop, quit, they are easily implemented by do_start, do_stop and do_quit. there are no troubles. But I want to implement some commands like these list-modules, show-info. There is a character - among the string. So I can't easily use do_list-modules, because the name is invalid. I attempt another ways, add a sentense in function cmd.onecmd: --- def onecmd(self, line): line = line.replace(-, _) # I add ... --- Then, I can use do_list_modules to mach list-modules command. But in this way, completion cannot work correctly. If I input list-, and then tab, it would not complete. If my way is correct when encoutering commands with - ? If it's correct, how can I implement completion to work correctly? thanks, yuanzheng. The problem with the replace() is that if there are any other dashes in the command, you'll replace them as well. Further, there are lots of other characters that are legal in program names that are not legal in variable names. It isn't clear why you care that the do_show_info function has a name that is transformable from the show-info command string. A shell has a few builtin commands, but most of them are simply names of external files, and it's those which would have dashes or other awkward characters. Are you planning to have a separate function for every one of those possible external programs? As for tab-completion, you haven't given us any clue about your environment (Linux, OS/MFT, ...), nor how the tab completion is caused currently. Ideally, on a shell, the tab completion algorithm would be much different than it would for normal programmatic access. In particular, when completing the first name on the line, tab completion should use the PATH, and when completing other names, it should escape characters like space, tab and backslash. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Finding keywords
On 01/-10/-28163 02:59 PM, Cross wrote: Hello I have got a project in which I have to extract keywords given a URL. I would like to know methods for extraction of keywords. Frequency of occurence is one; but it seems naive. I would prefer something more robust. Please suggest. Regards Cross --- news://freenews.netfront.net/ - complaints: n...@netfront.net --- The keywords are an attribute in a tag called meta, in the section called head. Are you having trouble parsing the xhtml to that point? Be more specific in your question, and somebody is likely to chime in. Although I'm not the one, if it's a question of parsing the xhtml. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Generate PDF with Tamil font problem
On 05/03/2011 05:20, sathe...@e-ndicus.com wrote: Hi All, I am using python's reportlab to print some unicode Tamil characters '#2986;#3015;'. I added necessary unicode font to reportlab. But It prints the output as '#3015;#2986;' (in reverse order). This issue happens for multi-byte characters, whereas for character '#2986;' is printed as it is. I am struggling to figure out the issue. Any help would see me on track. ... you can ask at the reportlab mailing list reportlab-us...@reportlab.com; the use of numeric entities is supported in paragraph text, but not in canvas.drawString and similar. There you need to use either unicode or a utf8 encoded byte string. -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list
Re: A question about Cmd Class
yuan zheng wrote: Hello, everyone: I encouter a question when implementing a commmand line(shell). I have implemented some commands, such as start, stop, quit, they are easily implemented by do_start, do_stop and do_quit. there are no troubles. But I want to implement some commands like these list-modules, show-info. There is a character - among the string. So I can't easily use do_list-modules, because the name is invalid. I attempt another ways, add a sentense in function cmd.onecmd: --- def onecmd(self, line): line = line.replace(-, _) # I add ... --- Then, I can use do_list_modules to mach list-modules command. But in this way, completion cannot work correctly. If I input list-, and then tab, it would not complete. If my way is correct when encoutering commands with - ? If it's correct, how can I implement completion to work correctly? It looks like the command class hasn't been designed with that kind of flexibility in mind. Here's how far I got: import cmd class MyCmd(cmd.Cmd): identchars = cmd.Cmd.identchars + - def get_names(self): names = cmd.Cmd.get_names(self) result = [] for name in names: if name.startswith(do_): name = do_ + name[3:].replace(_, -) result.append(name) return result def __getattr__(self, name): if - in name: return getattr(self, name.replace(-, _)) raise AttributeError def completenames(self, text, *ignored): return cmd.Cmd.completenames(self, text.replace(-, _), *ignored) class Cmd(MyCmd): def do_eat_fish(self, rest): print eat fish, rest def do_drink_beer(self, rest): print drink beer, rest def do_EOF(self, rest): return True if __name__ == __main__: c = Cmd() c.cmdloop() If you need the help_ prefix to work, too, you have to tweak it further. I don't know if there are other hidden quirks... Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Finding keywords
On 03/08/2011 06:09 PM, Heather Brown wrote: The keywords are an attribute in a tag called meta, in the section called head. Are you having trouble parsing the xhtml to that point? Be more specific in your question, and somebody is likely to chime in. Although I'm not the one, if it's a question of parsing the xhtml. DaveA I know meta tags contain keywords but they are not always reliable. I can parse xhtml to obtain keywords from meta tags; but how do I verify them. To obtain reliable keywords, I have to parse the plain text obtained from the URL. Cross --- news://freenews.netfront.net/ - complaints: n...@netfront.net --- -- http://mail.python.org/mailman/listinfo/python-list
Switching between Python releases under Windows
I have multiple versions of Python installed under Vista. Is there any easy way of switching between them so that invoking python and file associations for Python extensions files work automatically ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Switching between Python releases under Windows
On 08/03/2011 14:55, Edward Diener wrote: I have multiple versions of Python installed under Vista. Is there any easy way of switching between them so that invoking python and file associations for Python extensions files work automatically ? Well, the answer depends a bit on how au fait you are with fiddling with env vars etc. but, if it helps, this script: https://winsys.googlecode.com/svn/trunk/random/associate.py will set the version of Python which runs it as the default. If you're running on Vista/W7, you'll probably need to run it with a param of user or inside an Elevated command prompt. TJG (Won't work w/ Python 3 without a bit of tweaking) -- http://mail.python.org/mailman/listinfo/python-list
Re: Switching between Python releases under Windows
On 08/03/2011 15:58, Tim Golden wrote: On 08/03/2011 14:55, Edward Diener wrote: I have multiple versions of Python installed under Vista. Is there any easy way of switching between them so that invoking python and file associations for Python extensions files work automatically ? Well, the answer depends a bit on how au fait you are with fiddling with env vars etc But essentially involves: * Adding c:\pythonxy and c:\pythonxy\script to PATH * assoc .py=python.file [probably already done] * python.file=C:\Pythonxy\python.exe %1 %* TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: Switching between Python releases under Windows
Edward Diener wrote: I have multiple versions of Python installed under Vista. Is there any easy way of switching between them so that invoking python and file associations for Python extensions files work automatically ? These associations are stored in the registry. Just cut out the according sections[1] with the settings for each Python version and save them in a file each. You can then simply re-import the variant with the settings that you need in order to change. Note that these .reg files are just text files, so you can also change them using a text editor if there is need. Uli [1] e.g. HKEY_CLASSES_ROOT\Python.File -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list
python cmd.Cmd auto complete feature
Hello folks, I'm trying to autoexpand values as well as arguments using the builtin cmd.Cmd class. I.E. Consider the following command and arguments: sayHello target=Georges 'Hello Georges !' I can easily make 'tar' expand into 'target=' however I'd like to be able to expand the value as well, choosing the target within a predefined list. ie. sayHello target=tab target=Georges target=Charles However I have the feeling that cmd.Cmd consider the '=' character in the way it will not try to expand anything beyond. When double tabbing after the '=' it will print the list of available arguemnt (i.e ['target'] in the exemple above). Ddd anyone successfuly expand values with cmd.Cmd ? JM Here a code sample illutrating the issue, type the linde sayHello target=tabtab to trigger the problem: import cmd class SayHello(cmd.Cmd): def do_sayHello(self, line): print 'Hello %s !' % line.split('=')[1] def complete_sayHello(self, text, line, begidx, endidx): cmds = ['target', 'anotherCmd'] targets = ['Georges', 'Charles'] if text.startswith('target='): completions = [target for target in ['target=Georges', 'target=Charles'] if target.startswith(text)] else: completions = [_cmd for _cmd in cmds if _cmd.startswith(text)] return completions def do_EOF(self, line): return True if __name__ == '__main__': SayHello().cmdloop() -- http://mail.python.org/mailman/listinfo/python-list
Re: Switching between Python releases under Windows
At 10:03 AM 3/8/2011, Tim Golden wrote: On 08/03/2011 15:58, Tim Golden wrote: On 08/03/2011 14:55, Edward Diener wrote: I have multiple versions of Python installed under Vista. Is there any easy way of switching between them so that invoking python and file associations for Python extensions files work automatically ? Well, the answer depends a bit on how au fait you are with fiddling with env vars etc But essentially involves: * Adding c:\pythonxy and c:\pythonxy\script to PATH * assoc .py=python.file [probably already done] * python.file=C:\Pythonxy\python.exe %1 %* More of the answer... There are perhaps two different things you are asking for. One is easy, one is icky. If you want to just run the different versions from command line, that is just playing with the PATH environment variable. I start a new command window for each version I'm needing and run a canned .bat for that version, such as this: C:\Toms\Utiltype pathpy32.bat @echo off rem Add Python 3.2.0 to path path C:\Python32;C:\Python32\Scripts;%path% path And yes, I have one .bat file each for 2.6, 2.7, 3.1, 3.2 and then the Perl versions and then the ... Note that you may want to remove the defaulted PATH additions for Python that each command window starts with. Control Panel / System / Advanced System Settings / Environment Variables / System Variables , double-click on 'Path' and edit as needed (carefully). If you really want to use file associations so that you can simply double-click on 'icons' and execute programs, you need to delve into Windows registry hacks and tools. (that's icky) Tim mentioned 'assoc' and that most any Python install will have already 'associated' the file extensions for Python. Check using something like: C:\Tomsassoc | grep -i pyth .py=Python.File .pyc=Python.CompiledFile .pyo=Python.CompiledFile .pyw=Python.NoConFile (or assoc | find /I Python if you don't have Cygwin installed) But the part you want to be changing as you switch versions is the file type associations, via command 'ftype'. Check using something like: C:\Tomsftype | grep -i pyth Python.CompiledFile=C:\Python32\python.exe %1 %* Python.File=C:\Python32\python.exe %1 %* Python.NoConFile=C:\Python32\pythonw.exe %1 %* To update you can run something like: C:\Windows\system32ftype Python.File=C:\Python27\python.exe %1 %* Python.File=C:\Python27\python.exe %1 %* You may need to start a command window with Run as Administrator in order to be able to update those values. And since you might want/need to update all three of those ftype values when switching between versions, you'll want to put them in a .bat file, and a separate one for each version. (Hmm, maybe that'll let you double-click on an icon for the batch files to switch more easily between versions?) The corresponding Windows registry keys for all this are: Computer\HKEY_CLASSES_ROOT\.py Computer\HKEY_CLASSES_ROOT\Python.File Computer\HKEY_CLASSES_ROOT\Python.File\shell\open\command C:\Python32\python.exe %1 %* Computer\HKEY_CLASSES_ROOT\Python.File\shell\Edit with IDLE\command C:\Python32\pythonw.exe C:\Python32\Lib\idlelib\idle.pyw -e %1 and so on. -- I'm a pessimist about probabilities; I'm an optimist about possibilities. Lewis Mumford (1895-1990) -- http://mail.python.org/mailman/listinfo/python-list
Dijkstra Algorithm Help
Hello, I am having a little trouble writing Dijkstra's Algorithm, at the point where I have to calculate the distance of each node from the source - here is my code so far: infinity = 100 invalid_node = -1 startNode = 0 class Node: distFromSource = infinity previous = invalid_node visited = False def populateNodeTable(): nodeTable = [] index =0 f = open('route.txt', 'r') for line in f: node = map(int, line.split(',')) nodeTable.append(Node()) print nodeTable[index].previous print nodeTable[index].distFromSource index +=1 nodeTable[startNode].distFromSource = 0 return nodeTable def tentativeDistance(currentNode, nodeTable): nearestNeighbour = [] for currentNode in nodeTable: if Node[currentNode].distFromSource + #currentDistance = + nodeTable[currentNode] # currentDistance = currentNode.distFromSource + nodeTable.currentNode currentNode.previous = currentNode currentNode.length = currentDistance currentNode.visited = True currentNode +=1 nearestNeighbour.append(currentNode) print nearestNeighbour return nearestNeighbour currentNode = startNode if __name__ == __main__: populateNodeTable() tentativeDistance(currentNode,populateNodeTable()) As can be seen from the lines commented out, I have tried a few ways of getting the distance though none of them has worked; I am not sure on how I can resolve this problem -- http://mail.python.org/mailman/listinfo/python-list
Deploying on Windows servers : advice sought a module
We have written a cross-platform monitoring system that we have deployed on our Linux servers and wish to put on our Windows servers too. In the past I've played with py2exe and similar packages. However the frequent updates to the monitoring suite mean that reinstalling an exe for each update would quickly become onerous. As we are used to the excellent versioning and updates provided by Debian I'm wary of installing different packages around the internet onto each Windows server. Is there a good way of combining packages and dependencies into an easily-deployable, and easily-updateable unit? Advice gratefully received. Notes about our setup: The Linux servers all have local installs of mercurial, python-yaml and Python 2.6. The advantage of having mercurial locally installed on each server is that we are making fairly frequent updates to the system and we can easily automate the hg pull/update process. Windows servers use Tim Golden's WMI modules and the pywin32 extensions. -- Rory Campbell-Lange r...@campbell-lange.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Dijkstra Algorithm Help
On 08/03/2011 18:12, yoro wrote: Hello, I am having a little trouble writing Dijkstra's Algorithm, at the point where I have to calculate the distance of each node from the source - here is my code so far: infinity = 100 invalid_node = -1 startNode = 0 class Node: distFromSource = infinity previous = invalid_node visited = False def populateNodeTable(): nodeTable = [] index =0 f = open('route.txt', 'r') for line in f: node = map(int, line.split(',')) node will be a list of ints, but you're not doing anything with them. nodeTable.append(Node()) print nodeTable[index].previous print nodeTable[index].distFromSource index +=1 nodeTable[startNode].distFromSource = 0 return nodeTable def tentativeDistance(currentNode, nodeTable): nearestNeighbour = [] for currentNode in nodeTable: if Node[currentNode].distFromSource + #currentDistance = + nodeTable[currentNode] # currentDistance = currentNode.distFromSource + nodeTable.currentNode currentNode.previous = currentNode currentNode.length = currentDistance currentNode.visited = True currentNode +=1 nearestNeighbour.append(currentNode) print nearestNeighbour return nearestNeighbour currentNode = startNode if __name__ == __main__: populateNodeTable() The only effect of populateNodeTable is to return a node table, which is then discarded. tentativeDistance(currentNode,populateNodeTable()) As can be seen from the lines commented out, I have tried a few ways of getting the distance though none of them has worked; I am not sure on how I can resolve this problem -- http://mail.python.org/mailman/listinfo/python-list
Re: python cmd.Cmd auto complete feature
Jean-Michel Pichavant wrote: I'm trying to autoexpand values as well as arguments using the builtin cmd.Cmd class. I.E. Consider the following command and arguments: sayHello target=Georges 'Hello Georges !' I can easily make 'tar' expand into 'target=' however I'd like to be able to expand the value as well, choosing the target within a predefined list. ie. sayHello target=tab target=Georges target=Charles However I have the feeling that cmd.Cmd consider the '=' character in the way it will not try to expand anything beyond. When double tabbing after the '=' it will print the list of available arguemnt (i.e ['target'] in the exemple above). Ddd anyone successfuly expand values with cmd.Cmd ? Some digging shows that your feeling is right: http://docs.python.org/library/readline.html#readline.get_completer_delims import readline readline.get_completer_delims() ' \t\n`~!@#$%^*()-=+[{]}\\|;:\',/?' After some initial problems with an extra space the following seems to work: import cmd import readline class SayHello(cmd.Cmd): def __init__(self): cmd.Cmd.__init__(self) delims = readline.get_completer_delims().replace(=, ) readline.set_completer_delims(delims) def do_sayHello(self, line): print 'Hello %s !' % line.split('=')[1] def complete_sayHello(self, text, line, begidx, endidx): target_with_value = [target= + v for v in Charles Georges.split()] commands = [target, tarpit, anotherCmd] if text.startswith(target=): return [c for c in target_with_value if c.startswith(text)] completions = [c for c in commands if c.startswith(text)] if completions == [target]: # avoid blank after target return target_with_value return completions def do_EOF(self, line): return True if __name__ == '__main__': SayHello().cmdloop() -- http://mail.python.org/mailman/listinfo/python-list
Re: Finding keywords
On 08/03/2011 8:58 AM, Cross wrote: I know meta tags contain keywords but they are not always reliable. I can parse xhtml to obtain keywords from meta tags; but how do I verify them. To obtain reliable keywords, I have to parse the plain text obtained from the URL. I think maybe what the OP is asking about is extracting key words from a text, i.e. a short list of words that characterize the text. This is an information retrieval problem, not really a Python problem. One simple way to do this is to calculate word frequency histograms for each document in your corpus, and then for a given document, select words that are frequent in that document but infrequent in the corpus as a whole. Whoosh does this. There are different ways of calculating the importance of words, and stemming and conflating synonyms can give you better results as well. A more sophisticated method uses part of speech tagging. See the Python Natural Language Toolkit (NLTK) and topia.termextract for more information. http://pypi.python.org/pypi/topia.termextract/ Yahoo has a web service for key word extraction: http://developer.yahoo.com/search/content/V1/termExtraction.html You might want to investigate these resources and try google searches for e.g. extracting key terms from documents and then come back if you have a question about the Python implementation. Cheers, Matt -- http://mail.python.org/mailman/listinfo/python-list
Re: Dijkstra Algorithm Help
On Mar 8, 6:49 pm, MRAB pyt...@mrabarnett.plus.com wrote: On 08/03/2011 18:12, yoro wrote: Hello, I am having a little trouble writing Dijkstra's Algorithm, at the point where I have to calculate the distance of each node from the source - here is my code so far: infinity = 100 invalid_node = -1 startNode = 0 class Node: distFromSource = infinity previous = invalid_node visited = False def populateNodeTable(): nodeTable = [] index =0 f = open('route.txt', 'r') for line in f: node = map(int, line.split(',')) node will be a list of ints, but you're not doing anything with them. nodeTable.append(Node()) print nodeTable[index].previous print nodeTable[index].distFromSource index +=1 nodeTable[startNode].distFromSource = 0 return nodeTable def tentativeDistance(currentNode, nodeTable): nearestNeighbour = [] for currentNode in nodeTable: if Node[currentNode].distFromSource + # currentDistance = + nodeTable[currentNode] # currentDistance = currentNode.distFromSource + nodeTable.currentNode currentNode.previous = currentNode currentNode.length = currentDistance currentNode.visited = True currentNode +=1 nearestNeighbour.append(currentNode) print nearestNeighbour return nearestNeighbour currentNode = startNode if __name__ == __main__: populateNodeTable() The only effect of populateNodeTable is to return a node table, which is then discarded. tentativeDistance(currentNode,populateNodeTable()) As can be seen from the lines commented out, I have tried a few ways of getting the distance though none of them has worked; I am not sure on how I can resolve this problem Thanks for replying, maybe i'm misunderstanding your comment - nodeTable is used to store the distances from source of each node within a text file, the file having the format : 1,2,3,4,5,6,7,8,9 1,2,3,4,5,6,7,8,9 Each of these nodes will have the same settings as set out in Class Node, i.e. all having no previous nodes. I am then trying to pass this parameter to the next function so that the distance from the start node can be calculated -- http://mail.python.org/mailman/listinfo/python-list
RE: CentOS 5.5 x86_64 rpmbuild from source
I will answer myself. For those interested, because rpm will break the dependencies on the OS, you can install 2.7 with a simple bash script: http://willsani.com/2011/03/02/centos-5-5-x86_64-install-python-2-7/ Regards, Will -- http://mail.python.org/mailman/listinfo/python-list
Re: Finding keywords
2011/3/8 Cross x...@x.tv: On 03/08/2011 06:09 PM, Heather Brown wrote: The keywords are an attribute in a tag called meta, in the section called head. Are you having trouble parsing the xhtml to that point? Be more specific in your question, and somebody is likely to chime in. Although I'm not the one, if it's a question of parsing the xhtml. DaveA I know meta tags contain keywords but they are not always reliable. I can parse xhtml to obtain keywords from meta tags; but how do I verify them. To obtain reliable keywords, I have to parse the plain text obtained from the URL. Cross --- news://freenews.netfront.net/ - complaints: n...@netfront.net --- -- http://mail.python.org/mailman/listinfo/python-list Hi, if you need to extract meaningful keywords in terms of data mining using natural language processing, it might become quite a complex task, depending on the requirements; the NLTK toolkit may help with some approaches [ http://www.nltk.org/ ]. One possibility would be to filter out more frequent and less meaningful words (stopwords) and extract the more frequent words from the reminder., e.g. (with some simplifications/hacks in the interactive mode): import re, urllib2, nltk page_src = urllib2.urlopen(http://www.python.org/doc/essays/foreword/;).read().decode(utf-8) page_plain = nltk.clean_html(page_src).lower() txt_filtered = nltk.Text((word for word in re.findall(r(?u)\w+, page_plain) if word not in set(nltk.corpus.stopwords.words(english frequency_dist = nltk.FreqDist(txt_filtered) [(word, freq) for (word, freq) in frequency_dist.items() if freq 2] [(u'python', 39), (u'abc', 11), (u'code', 10), (u'c', 7), (u'language', 7), (u'programming', 7), (u'unix', 7), (u'foreword', 5), (u'new', 5), (u'would', 5), (u'1st', 4), (u'book', 4), (u'ed', 4), (u'features', 4), (u'many', 4), (u'one', 4), (u'programmer', 4), (u'time', 4), (u'use', 4), (u'community', 3), (u'documentation', 3), (u'early', 3), (u'enough', 3), (u'even', 3), (u'first', 3), (u'help', 3), (u'indentation', 3), (u'instance', 3), (u'less', 3), (u'like', 3), (u'makes', 3), (u'personal', 3), (u'programmers', 3), (u'readability', 3), (u'readable', 3), (u'write', 3)] Another possibility would be to extract parts of speech (e.g. nouns, adjective, verbs) using e.g. nltk.pos_tag(input_txt) etc.; for more convoluted html code e.g. BeautifulSoup might be used and there are likely many other options. hth, vbr -- http://mail.python.org/mailman/listinfo/python-list
Re: CentOS 5.5 x86_64 rpmbuild from source
William S. wrote: I will answer myself. For those interested, because rpm will break the dependencies on the OS, you can install 2.7 with a simple bash script: http://willsani.com/2011/03/02/centos-5-5-x86_64-install-python-2-7/ If you use a spec file for the original RPM and modify it for the newer version of python, you will not break any dependencies. -- //Aho -- http://mail.python.org/mailman/listinfo/python-list
Re: Numerical representation
Thanks all for the input, the remark about printing intermediate steps was a very good one (and so obvious I can't believe it took me this long to get there...) The error was in my loop where I multiply by the b or beta coefficients. The range for this loop (marked by j) is set up properly in Matlab (1 to nn) but in Python running this over range(nn) drops the values of the column 'nn'. That means the coefficients were all wrong. This quickly became apparent as I was printing a number of internal values. Thank you for the assistance, I apologize for asking your time for such a beginner's oversight...I'll be fluent in Python some day ;-) On Mon, Mar 7, 2011 at 5:34 PM, Robert Kern robert.k...@gmail.com wrote: On 3/7/11 2:52 PM, Jon Herman wrote: It really is exactly the same process, but sure. Below is my Matlab translation of the python code I posted earlier, it functions at the increased accuracy I've shown above. k(:,1)=feval(deq, ti, x, mu); for n = 2:1:13 nn=n-1; Xtemp1 = 0.0; for j = 1:1:nn Xtemp1 = Xtemp1 + beta(n,j) * k(:,j); end x=xwrk+ dt * Xtemp1; ti=twrk+alph(n)*dt; k(:,n)=feval(deq, ti, x, mu); end Xtemp2=0.0; for l = 1:1:13 Xtemp2=Xtemp2+ch(l)*k(:,l); end x=xwrk + dt * Xtemp2; t=twrk+dt; You may want to try printing out values in both implementations to see where they start to diverge. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: embedded python 2.7.1 slow startup
On 3/8/2011 4:06 AM, bruce bushby wrote: Hi I've been playing with running python on embedded linux. I thought I would run some straces to see how the install went when I noticed python attempts to open loads of files that don't exist.is there a way to prevent these open attemptsthey're responsible for 40% of my scripts execution time. I was wondering if there is a way to prevent python from attempting to open files I know are not there? The problem is that *python* does not know. Most of the failed attempts are from looking for a compiled shared library version of every module to be imported. I wonder if it would be faster to make a set with all shared library names and check that instead before going to the file system. On an embedded system, especially, something might even be built into the binary or read at startup. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: SCM
On Mar 8, 7:21 am, Stefan Behnel stefan...@behnel.de wrote: Cliff Scherer, 08.03.2011 12:42: I am looking for a Python library, which can handle the modelling of material flows in Supply Chains. Note that TLAs do not always uniquely identify a subject. SCM is easily read as source code management or software configuration management on a programming related list. There's also a Scheme implementation with that name. Stefan That's how I read it -- I was interested because I thought the thread was about source control management. Rafe -- http://mail.python.org/mailman/listinfo/python-list
multiprocessing module in async db query
This looks like a tornado problem, but trust me, it is almost all about the mechanism of multiprocessing module. I borrowed the idea from http://gist.github.com/312676 to implement an async db query web service using tornado. p = multiprocessing.Pool(4) class QueryHandler(tornado.web.RequestHandler): ... @tornado.web.asynchronous def get(self): ... p.apply_async(async_func, [sql_command, arg1, arg2, arg3, ], callback_func) def callback_func(self, data): self.write(data) def async_func(sql_command, arg1, arg2, arg3): ''' do the actual query job ''' ... # data is the query result by executing sql_command return data So the workflow is like this, get() -- fork a subprocess to process the query request in async_func() - when async_func() returns, callback_func uses the return result of async_func as the input argument, and send the query result to the client. So the problem is the the query result as the result of sql_command might be too big to store them all in the memory, which in our case is stored in the variable data. Can I send return from the async method early, say immediately after the query returns with the first result set, then stream the results to the browser. In other words, can async_func somehow notify callback_func to prepare receiving the data before async_func actually returns? -- http://mail.python.org/mailman/listinfo/python-list
Re: Finding keywords
On 3/8/2011 2:00 PM, Matt Chaput wrote: On 08/03/2011 8:58 AM, Cross wrote: I know meta tags contain keywords but they are not always reliable. I can parse xhtml to obtain keywords from meta tags; but how do I verify them. To obtain reliable keywords, I have to parse the plain text obtained from the URL. This, of course, is a problem for all search engines, especially given 'search optimization' games. I think maybe what the OP is asking about is extracting key words from a text, i.e. a short list of words that characterize the text. This is an information retrieval problem, not really a Python problem. One simple way to do this is to calculate word frequency histograms for each document in your corpus, and then for a given document, select words that are frequent in that document but infrequent in the corpus as a whole. Whoosh does this. I believe Google does something like this also. I have seen a claim that Google only looks at the first x words, hence the advice 'Make sure your target keywords are in the first x words.'. You, of course, can and should process entire docs -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Python language changes that first shipped in something besides CPython?
I'm doing a talk at PyCon about changes to the Python language. I'm wondering: are there any Python language changes that first shipped in an implementation of Python besides CPython? The sort of answer I'm looking for: set literals first shipped in Jython 2.2, six months before they shipped in CPython 2.3. (Note that that specific answer is wrong in every important detail.) /larry/ -- http://mail.python.org/mailman/listinfo/python-list
Re: A question about Cmd Class
On Monday 2011 March 07 18:41, yuan zheng wrote: Hello, everyone: I encouter a question when implementing a commmand line(shell). I have implemented some commands, such as start, stop, quit, they are easily implemented by do_start, do_stop and do_quit. there are no troubles. But I want to implement some commands like these list-modules, show-info. There is a character - among the string. So I can't easily use do_list-modules, because the name is invalid. I attempt another ways, add a sentense in function cmd.onecmd: --- def onecmd(self, line): line = line.replace(-, _) # I add ... --- Then, I can use do_list_modules to mach list-modules command. But in this way, completion cannot work correctly. If I input list-, and then tab, it would not complete. That is because the readline module uses '-' as one of its stop characters. You can try this code I used: # PyPI package names can contain hyphens. # readline interprets a hyphen as a word boundary. # We need to remove the hyphen from readline's # word boundary delimiters so that our findpkg # command can complete on package name. import readline delims = readline.get_completer_delims( ) delims = delims.replace('-', '') readline.set_completer_delims(delims) del delims -- http://mail.python.org/mailman/listinfo/python-list
Defining class attributes + inheritance
Hi, I think this might be obvious? I have a base class which contains X objects which other classes inherit e.g. class BaseClass(object): def __init__(self, something, something_else): self.something = something self.something_else = something_else # etc Typically I would use this like this from some_module_name import BaseClass class NewClass(BaseClass): def do_something(self): print self.something # etc Which is fine. However if I need to inherit additional attributes (to NewClass) at the constructor step it means I have to completely redefine the constructor and therefore can't inherit in this way, which defeats the purpose of defining a default base class. Am I being slow is there a nice solution to this or is that the way it works? thanks, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Defining class attributes + inheritance
On Mar 8, 2011 6:02 PM, Martin De Kauwe mdeka...@gmail.com wrote: Hi, I think this might be obvious? I have a base class which contains X objects which other classes inherit e.g. class BaseClass(object): def __init__(self, something, something_else): self.something = something self.something_else = something_else # etc Typically I would use this like this from some_module_name import BaseClass class NewClass(BaseClass): def do_something(self): print self.something # etc Which is fine. However if I need to inherit additional attributes (to NewClass) at the constructor step it means I have to completely redefine the constructor and therefore can't inherit in this way, which defeats the purpose of defining a default base class. Am I being slow is there a nice solution to this or is that the way it works? thanks, Martin Why does overriding the constructor make inheritance useless? You just have to call the superclass's constructor, same as in every other OOP language I've used. You can use *args and **kwargs to avoid relisting all the superclass's arguements. def __init__(self, newarg, *args, **kwargs): BaseClass.__init__(self, *args,**kwargs) self.newarg = newarg -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Defining class attributes + inheritance
Martin De Kauwe wrote: Hi, I think this might be obvious? I have a base class which contains X objects which other classes inherit e.g. class BaseClass(object): def __init__(self, something, something_else): self.something = something self.something_else = something_else # etc Typically I would use this like this from some_module_name import BaseClass class NewClass(BaseClass): def do_something(self): print self.something # etc Which is fine. However if I need to inherit additional attributes (to NewClass) at the constructor step it means I have to completely redefine the constructor [...] Just make sure and call the parent's constructor, either with class NewClass(BaseClass): def __init__(self, ): BaseClass.__init__(self, other_params) or class NewClass(BaseClass): def __init__(self, ): super(NewClass, self).__init__() ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Re: Pickle a list
On 07-03-11 17:38, Rogerio Luz wrote: import sys import pickle class MyClass: teste = 0 nome = None lista = [default] def __init__(self): for reg in range(1,10): self.lista.append(reg) ^^ This probably doesn't do what you think it does. It actually appends a range of numbers to the class attribute 'lista', and not to the instance attribute of that name (which doesn't exist). If you create multiple objects of type MyClass you'll notice that everytime the list gets longer and longer (...in *all* objects, because they still share the single class attribute!) self.nome = TestStr self.teste = 19900909 [...snip...] The myClass object you're pickling doesn't have a 'lista' attribute. While you can print myClass.lista without problems, you're printing the class attribute instead. Pickle won't include class attributes. It just pickles the object's __dict__. If you add a line: print(myClass.__dict__) before the pickle() call you'll see that 'lista' is not in there. And that means that when you read the pickle back in, the new object won't have the 1,2,3,4,5 numbers in the lista list, instead it just has the initial list. You probably want to initialize self.alist in the class's __init__ method instead. That way it is a normal object attribute and will get pickled normally. Irmen de Jong -- http://mail.python.org/mailman/listinfo/python-list
attach to process by pid?
Howdy, Is there any way to attach to an already running process by pid? I want to send commands from python to an application that is already running. I don't want to give the command name to subprocess.Popen. thanks, Danny -- http://mail.python.org/mailman/listinfo/python-list
Re: multiprocessing module in async db query
On Mar 8, 2011, at 3:25 PM, Sheng wrote: This looks like a tornado problem, but trust me, it is almost all about the mechanism of multiprocessing module. [snip] So the workflow is like this, get() -- fork a subprocess to process the query request in async_func() - when async_func() returns, callback_func uses the return result of async_func as the input argument, and send the query result to the client. So the problem is the the query result as the result of sql_command might be too big to store them all in the memory, which in our case is stored in the variable data. Can I send return from the async method early, say immediately after the query returns with the first result set, then stream the results to the browser. In other words, can async_func somehow notify callback_func to prepare receiving the data before async_func actually returns? Hi Sheng, Have you looked at multiprocessing.Queue objects? HTH Philip -- http://mail.python.org/mailman/listinfo/python-list
Re: Deploying on Windows servers : advice sought a module
At my work place I still use py2exe but I do not rely on its automatic discovery and packaging. The setup.py lists all the dependencies explicitly in packages and includes parameters. These end up in library.zip. Then the source file paths with the actual business logic are gathered with os.walk and passed in as data_files parameter. Finally the actual service executable is generated from the very minimal script. This executable is registered only once and as long as you do not move it to a different directory Windows will find it and start it up for you. The service script that gets used by py2exe is truly minimal. It just changes working directory to where the executable sits, adds current directory to the sys.path and loads the main script. The main script would be copied by setup.py into the current working directory. When there is a new release I update the files with business logic and restart the service. When I want to update the dependent libraries I regenerate library.zip, copy it over and again restart the service. The trick is to let the files from the current directory to be imported first. To achieve it you should avoid putting your business logic files into your library.zip. py2exe will do it if you let it to. Depending on situation I go to into dirty tricks like selectively commenting out import statements before running py2exe or even post-processing library.zip and deleting the business logic files from the archive. With a little bit of care you can make it work but I admit my approach is not very clean. Oh another trick I have learned. If your service does not start because let's say an import has failed look into Event Viewer/Application. There should be an entry with a nice traceback listing what went wrong. Waldemar -- http://mail.python.org/mailman/listinfo/python-list
Re: multiprocessing module in async db query
On 3/8/2011 3:34 PM, Philip Semanchuk wrote: On Mar 8, 2011, at 3:25 PM, Sheng wrote: This looks like a tornado problem, but trust me, it is almost all about the mechanism of multiprocessing module. [snip] So the workflow is like this, get() -- fork a subprocess to process the query request in async_func() - when async_func() returns, callback_func uses the return result of async_func as the input argument, and send the query result to the client. So the problem is the the query result as the result of sql_command might be too big to store them all in the memory, which in our case is stored in the variable data. Can I send return from the async method early, say immediately after the query returns with the first result set, then stream the results to the browser. In other words, can async_func somehow notify callback_func to prepare receiving the data before async_func actually returns? Hi Sheng, Have you looked at multiprocessing.Queue objects? Make sure that, having made a request of the database, you quickly read all the results. Until you finish the transaction, the database has locks set, and other transactions may stall. Streaming out to a network connection while still reading from the database is undesirable. If you're doing really big SELECTs, consider using LIMIT and OFFSET in SQL to break them up into smaller bites. Especially if the user is paging through the results. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Re: Defining class attributes + inheritance
On Mar 9, 10:20 am, Ethan Furman et...@stoneleaf.us wrote: Martin De Kauwe wrote: Hi, I think this might be obvious? I have a base class which contains X objects which other classes inherit e.g. class BaseClass(object): def __init__(self, something, something_else): self.something = something self.something_else = something_else # etc Typically I would use this like this from some_module_name import BaseClass class NewClass(BaseClass): def do_something(self): print self.something # etc Which is fine. However if I need to inherit additional attributes (to NewClass) at the constructor step it means I have to completely redefine the constructor [...] Just make sure and call the parent's constructor, either with class NewClass(BaseClass): def __init__(self, ): BaseClass.__init__(self, other_params) or class NewClass(BaseClass): def __init__(self, ): super(NewClass, self).__init__() ~Ethan~ Hi thanks, but I think I am implementing it wrong then? BaseClass has 4 attributes and when I tried what you said class NewClass(BaseClass): def __init__(self): super(NewClass, self).__init__(new_thing) I get the error TypeError: __init__() takes exactly 1 argument (6 given) -- http://mail.python.org/mailman/listinfo/python-list
Re: attach to process by pid?
On Wed, Mar 9, 2011 at 9:20 AM, Danny Shevitz shev...@lanl.gov wrote: Is there any way to attach to an already running process by pid? I want to send commands from python to an application that is already running. I don't want to give the command name to subprocess.Popen. Unless I'm missing something here I don't see how you could achieve communication with another process unless that process has some kind of communication(s) interface; eg: * some kind of listening socket * some kind of I/O (pipe, stdin/stdout) cheers James -- -- James Mills -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-list
Re: Defining class attributes + inheritance
On Wed, Mar 9, 2011 at 9:20 AM, Ethan Furman et...@stoneleaf.us wrote: Just make sure and call the parent's constructor, either with class NewClass(BaseClass): def __init__(self, ): BaseClass.__init__(self, other_params) or class NewClass(BaseClass): def __init__(self, ): super(NewClass, self).__init__() In Python3 this is even easier (for the simplest case): class Base: ... def __init__(self, x): ... print(Hello %s % x) ... class ExtendedBase(Base): ... def __init__(self, x, y): ... super().__init__(x) ... print(Hello %s % y) ... x = ExtendedBase(foo, bar) Hello foo Hello bar cheers James -- -- James Mills -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-list
Re: Defining class attributes + inheritance
On Wed, 09 Mar 2011 00:29:18 -, Martin De Kauwe mdeka...@gmail.com wrote: On Mar 9, 10:20 am, Ethan Furman et...@stoneleaf.us wrote: [snip] Just make sure and call the parent's constructor, either with class NewClass(BaseClass): def __init__(self, ): BaseClass.__init__(self, other_params) or class NewClass(BaseClass): def __init__(self, ): super(NewClass, self).__init__() ~Ethan~ Hi thanks, but I think I am implementing it wrong then? BaseClass has 4 attributes and when I tried what you said class NewClass(BaseClass): def __init__(self): super(NewClass, self).__init__(new_thing) I get the error TypeError: __init__() takes exactly 1 argument (6 given) Please give us either the rest of the code or the rest of the traceback, or preferably both. Without one or the other we have little hope of guessing what you've typed. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list
Re: Defining class attributes + inheritance
On Mar 9, 11:50 am, Rhodri James rho...@wildebst.demon.co.uk wrote: On Wed, 09 Mar 2011 00:29:18 -, Martin De Kauwe mdeka...@gmail.com wrote: On Mar 9, 10:20 am, Ethan Furman et...@stoneleaf.us wrote: [snip] Just make sure and call the parent's constructor, either with class NewClass(BaseClass): def __init__(self, ): BaseClass.__init__(self, other_params) or class NewClass(BaseClass): def __init__(self, ): super(NewClass, self).__init__() ~Ethan~ Hi thanks, but I think I am implementing it wrong then? BaseClass has 4 attributes and when I tried what you said class NewClass(BaseClass): def __init__(self): super(NewClass, self).__init__(new_thing) I get the error TypeError: __init__() takes exactly 1 argument (6 given) Please give us either the rest of the code or the rest of the traceback, or preferably both. Without one or the other we have little hope of guessing what you've typed. -- Rhodri James *-* Wildebeest Herder to the Masses OK class BaseClass(object): def __init__(self, a, b, c, d): self.a = a self.b = b self.c = c self.d = d class NewClass(BaseClass): def __init__(self): super(NewClass, self).__init__(new) self.new = new print self.new class PreviousClass: def __init__(self, a, b, c, d, new): self.a = a self.b = b self.c = c self.d = d self.new = new print self.new if __name__ == __main__: A = PreviousClass(1, 2, 3, 4, 5) B = NewClass(1, 2, 3, 4, 5) $ python test.py Traceback (most recent call last): File model_data.py, line 29, in module B = NewClass(1, 2, 3, 4, 5) TypeError: __init__() takes exactly 1 argument (6 given) So NewClass is my attempt to implement what I was shown and PreviousClass was how I was originally solving the issue, i.e. I wouldn't inherit the BaseClass. thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Python language changes that first shipped in something besides CPython?
On 3/8/2011 4:39 PM, Larry Hastings wrote: I'm doing a talk at PyCon about changes to the Python language. I'm wondering: are there any Python language changes that first shipped in an implementation of Python besides CPython? The sort of answer I'm looking for: set literals first shipped in Jython 2.2, six months before they shipped in CPython 2.3. (Note that that specific answer is wrong in every important detail.) For that type of feature, I am pretty sure the answer is no. There are developers from other implementations that have cpython commit rights and they have contributed new tests. Modules? I have never seen 'We first did this with xpython on the tracker, but it is possible. The best place to ask is the developer lists for each project. gmane.comp.lang.jython.devel gmane.comp.python.pypy gmane.comp.pyhton.ironpython.user (no devel here) -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Python language changes that first shipped in something besides CPython?
On 3/8/2011 4:39 PM, Larry Hastings wrote: Adding to my previous response, extended slices and ellipses were added for numerical python, but that is cpython extension, not alternative. The 3.x memoryview came from there too, I believe. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Defining class attributes + inheritance
Here's how you do inheritance: C:\python Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32 Type help, copyright, credits or license for more information. class BaseClass(object): ... def __init__(self, a, b, c, d): ... self.a = a ... self.b = b ... self.c = c ... self.d = d ... class NewClass(BaseClass): ... def __init__(self, a, b, c, d, new): ... super(NewClass, self).__init__(a, b, c, d) ... self.new = new ... A = BaseClass(1,2,3,4) print A.a, A.b, A.c, A.d 1 2 3 4 B = NewClass(1,2,3,4,5) print B.a, B.b, B.c, B.d, B.new 1 2 3 4 5 ~/santa On Tue, Mar 8, 2011 at 5:00 PM, Martin De Kauwe mdeka...@gmail.com wrote: On Mar 9, 11:50 am, Rhodri James rho...@wildebst.demon.co.uk wrote: On Wed, 09 Mar 2011 00:29:18 -, Martin De Kauwe mdeka...@gmail.com wrote: On Mar 9, 10:20 am, Ethan Furman et...@stoneleaf.us wrote: [snip] Just make sure and call the parent's constructor, either with class NewClass(BaseClass): def __init__(self, ): BaseClass.__init__(self, other_params) or class NewClass(BaseClass): def __init__(self, ): super(NewClass, self).__init__() ~Ethan~ Hi thanks, but I think I am implementing it wrong then? BaseClass has 4 attributes and when I tried what you said class NewClass(BaseClass): def __init__(self): super(NewClass, self).__init__(new_thing) I get the error TypeError: __init__() takes exactly 1 argument (6 given) Please give us either the rest of the code or the rest of the traceback, or preferably both. Without one or the other we have little hope of guessing what you've typed. -- Rhodri James *-* Wildebeest Herder to the Masses OK class BaseClass(object): def __init__(self, a, b, c, d): self.a = a self.b = b self.c = c self.d = d class NewClass(BaseClass): def __init__(self): super(NewClass, self).__init__(new) self.new = new print self.new class PreviousClass: def __init__(self, a, b, c, d, new): self.a = a self.b = b self.c = c self.d = d self.new = new print self.new if __name__ == __main__: A = PreviousClass(1, 2, 3, 4, 5) B = NewClass(1, 2, 3, 4, 5) $ python test.py Traceback (most recent call last): File model_data.py, line 29, in module B = NewClass(1, 2, 3, 4, 5) TypeError: __init__() takes exactly 1 argument (6 given) So NewClass is my attempt to implement what I was shown and PreviousClass was how I was originally solving the issue, i.e. I wouldn't inherit the BaseClass. thanks -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Defining class attributes + inheritance
On Wed, 09 Mar 2011 01:00:29 -, Martin De Kauwe mdeka...@gmail.com wrote: class BaseClass(object): def __init__(self, a, b, c, d): self.a = a self.b = b self.c = c self.d = d class NewClass(BaseClass): def __init__(self): super(NewClass, self).__init__(new) self.new = new print self.new Two things leap out immediately. First, BaseClass.__init__ takes four parameters besides `self`, but when you call it you only give it one parameter, `new`. It's not going to like that. Second, where did `new` come from? It's not a parameter to NewClass.__init__, and it doesn't seem to be a global. That's not going to work well either. However neither of these things are what the traceback is complaining about. if __name__ == __main__: A = PreviousClass(1, 2, 3, 4, 5) B = NewClass(1, 2, 3, 4, 5) $ python test.py Traceback (most recent call last): File model_data.py, line 29, in module B = NewClass(1, 2, 3, 4, 5) TypeError: __init__() takes exactly 1 argument (6 given) When you create your NewClass, you give it five parameters (1, 2, 3, 4, 5) plus the implicit `self`, which is the (6 given) part of the message. However NewClass.__init__ takes no parameters aside from `self` (i.e. it takes exactly 1 argument). There's a mismatch between what you've told NewClass.__init__ to expect and what you actually deliver to it. The point that may be confusing you is that NewClass.__init__ knows nothing at all about BaseClass.__init__. It doesn't inherit parameters from it or anything magical like that; you have to tell it everything. If you want parameters to pass from NewClass.__init__ to BaseClass.__init__ you will have to provide them somehow. In this case, I think what you meant was something like this: class NewClass(BaseClass): def __init__(self, a, b, c, d, new): super(NewClass, self).__init__(a, b, c, d) self.new = new # etc -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list
Re: Defining class attributes + inheritance
On Mar 9, 12:53 pm, Rhodri James rho...@wildebst.demon.co.uk wrote: On Wed, 09 Mar 2011 01:00:29 -, Martin De Kauwe mdeka...@gmail.com wrote: class BaseClass(object): def __init__(self, a, b, c, d): self.a = a self.b = b self.c = c self.d = d class NewClass(BaseClass): def __init__(self): super(NewClass, self).__init__(new) self.new = new print self.new Two things leap out immediately. First, BaseClass.__init__ takes four parameters besides `self`, but when you call it you only give it one parameter, `new`. It's not going to like that. Second, where did `new` come from? It's not a parameter to NewClass.__init__, and it doesn't seem to be a global. That's not going to work well either. However neither of these things are what the traceback is complaining about. if __name__ == __main__: A = PreviousClass(1, 2, 3, 4, 5) B = NewClass(1, 2, 3, 4, 5) $ python test.py Traceback (most recent call last): File model_data.py, line 29, in module B = NewClass(1, 2, 3, 4, 5) TypeError: __init__() takes exactly 1 argument (6 given) When you create your NewClass, you give it five parameters (1, 2, 3, 4, 5) plus the implicit `self`, which is the (6 given) part of the message. However NewClass.__init__ takes no parameters aside from `self` (i.e. it takes exactly 1 argument). There's a mismatch between what you've told NewClass.__init__ to expect and what you actually deliver to it. The point that may be confusing you is that NewClass.__init__ knows nothing at all about BaseClass.__init__. It doesn't inherit parameters from it or anything magical like that; you have to tell it everything. If you want parameters to pass from NewClass.__init__ to BaseClass.__init__ you will have to provide them somehow. In this case, I think what you meant was something like this: class NewClass(BaseClass): def __init__(self, a, b, c, d, new): super(NewClass, self).__init__(a, b, c, d) self.new = new # etc -- Rhodri James *-* Wildebeest Herder to the Masses Yep that was it, I think I misunderstood and assumed it knew about stuff in the BaseClass constructor. All makes sense now! -- http://mail.python.org/mailman/listinfo/python-list
Re: Python language changes that first shipped in something besides CPython?
Terry Reedy tjre...@udel.edu writes: For that type of feature, I am pretty sure the answer is no. There are developers from other implementations that have cpython commit rights and they have contributed new tests. Modules? I have never seen 'We first did this with xpython on the tracker, but it is possible. What about Stackless? Maybe some version of generators first appeared there? -- http://mail.python.org/mailman/listinfo/python-list
Re: Defining class attributes + inheritance
Remember the mantra, Explitic is better than implicit. ;-) ~/santa On Tue, Mar 8, 2011 at 7:15 PM, Martin De Kauwe mdeka...@gmail.com wrote: On Mar 9, 12:53 pm, Rhodri James rho...@wildebst.demon.co.uk wrote: On Wed, 09 Mar 2011 01:00:29 -, Martin De Kauwe mdeka...@gmail.com wrote: class BaseClass(object): def __init__(self, a, b, c, d): self.a = a self.b = b self.c = c self.d = d class NewClass(BaseClass): def __init__(self): super(NewClass, self).__init__(new) self.new = new print self.new Two things leap out immediately. First, BaseClass.__init__ takes four parameters besides `self`, but when you call it you only give it one parameter, `new`. It's not going to like that. Second, where did `new` come from? It's not a parameter to NewClass.__init__, and it doesn't seem to be a global. That's not going to work well either. However neither of these things are what the traceback is complaining about. if __name__ == __main__: A = PreviousClass(1, 2, 3, 4, 5) B = NewClass(1, 2, 3, 4, 5) $ python test.py Traceback (most recent call last): File model_data.py, line 29, in module B = NewClass(1, 2, 3, 4, 5) TypeError: __init__() takes exactly 1 argument (6 given) When you create your NewClass, you give it five parameters (1, 2, 3, 4, 5) plus the implicit `self`, which is the (6 given) part of the message. However NewClass.__init__ takes no parameters aside from `self` (i.e. it takes exactly 1 argument). There's a mismatch between what you've told NewClass.__init__ to expect and what you actually deliver to it. The point that may be confusing you is that NewClass.__init__ knows nothing at all about BaseClass.__init__. It doesn't inherit parameters from it or anything magical like that; you have to tell it everything. If you want parameters to pass from NewClass.__init__ to BaseClass.__init__ you will have to provide them somehow. In this case, I think what you meant was something like this: class NewClass(BaseClass): def __init__(self, a, b, c, d, new): super(NewClass, self).__init__(a, b, c, d) self.new = new # etc -- Rhodri James *-* Wildebeest Herder to the Masses Yep that was it, I think I misunderstood and assumed it knew about stuff in the BaseClass constructor. All makes sense now! -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Reference Cycles with instance method
Simple question. If I have the following code: class A: def __init__(self, s): self.s = s self.m2 = m1 def m1(self): pass if __name__ == '__main__': a = A(ads) a.m1() a = None The object is not garbage collected, since there appears to be a cycle (between method m2 and A). I would expect this to behave the same as having another method def m2(self): self.m1(), but unfortunately its not. In above case m2 seems to be in a.__dict__ which is causing the cycle. Any idea why this is so? Regards, Amit -- http://mail.python.org/mailman/listinfo/python-list
[issue11185] test_wait4 error on AIX
Sébastien Sablé sa...@users.sourceforge.net added the comment: Yes, for the test, as I put in msg128727, it works fine by removing WNOHANG. However I should put a note in the AIX-NOTES file to explain that wait4 is broken with WNOHANG on AIX and suggest the 2 workarounds. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11185 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11298] unittest discovery needs better explanation
Changes by blokeley bloke...@gmail.com: Removed file: http://bugs.python.org/file20863/py3k_rev9921_issue11298.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11298] unittest discovery needs better explanation
Changes by blokeley bloke...@gmail.com: Removed file: http://bugs.python.org/file20865/py2.7-maint_rev45852_issue11298.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11298] unittest discovery needs better explanation
Changes by blokeley bloke...@gmail.com: Removed file: http://bugs.python.org/file20866/py3.2-maint_rev9895_issue11298.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11298] unittest discovery needs better explanation
blokeley bloke...@gmail.com added the comment: Patch for py3k (default branch). -- Added file: http://bugs.python.org/file21042/issue11298_default.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11298] unittest discovery needs better explanation
blokeley bloke...@gmail.com added the comment: Patch for 2.7 branch. -- Added file: http://bugs.python.org/file21043/issue11298_py2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11298] unittest discovery needs better explanation
blokeley bloke...@gmail.com added the comment: Patch for 3.2 branch. This is the first time I've submitted patches so I hope the format is OK. If I could have submitted 1 patch to apply to 2.7, 3.2 and py3k at the same time let me know. Hope this helps. -- Added file: http://bugs.python.org/file21044/issue11298_py3.2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11432] webbrowser.open on unix fails.
Charles-Francois Natali neolo...@free.fr added the comment: The problem lies here: /* Close pipe fds. Make sure we don't close the same fd more than */ /* once, or standard fds. */ if (p2cread 2) { POSIX_CALL(close(p2cread)); } (c2pwrite 2) { POSIX_CALL(close(c2pwrite)); } if (errwrite != c2pwrite errwrite 2) { POSIX_CALL(close(errwrite)); } If p2cread == c2pwrite (which is the case here since /dev/null is passed as stdin and stderr), we end up closing the same FD twice, hence the EBADF. Just passing -(c2pwrite 2) { +(c2pwrite 2 c2pwrite != p2cread) { POSIX_CALL(close(c2pwrite)); } Solves this (but you probably also want to check for (errwrite != p2cread) when closing c2pwrite). Note that the Python implementation uses a set to avoid closing the same FD twice: # Close pipe fds. Make sure we don't close the # same fd more than once, or standard fds. closed = set() for fd in [p2cread, c2pwrite, errwrite]: if fd 2 and fd not in closed: os.close(fd) closed.add(fd) It might be cleaner to use a fd_set, i.e.: fd_set set; FD_ZERO(set); FD_SET(0, set); FD_SET(1, set); FD_SET(2, set); if (!FD_ISSET(p2cread, set)) { POSIX_CALL(close(p2cread)); FD_SET(p2cread, fd); } if (!FD_ISSET(c2pwrite, set)) { POSIX_CALL(close(c2pwrite)); FD_SET(c2pwrite, fd); } if (!FD_ISSET(errwrite, set)) { POSIX_CALL(close(errwrite)); FD_SET(errwrite, fd); } But maybe it's just too much (and also, fd_set can be defined in different header files, and while I'm sure it's async-safe on Linux, I don't know if it's required as part of a standard...). -- nosy: +neologix ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11432 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2636] Regexp 2.7 (modifications to current re 2.2.2)
Changes by Davide Rizzo sor...@gmail.com: -- nosy: +davide.rizzo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2636 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2771] new commit
Georg Brandl ge...@python.org added the comment: test the roundup hook http://hg.python.org/cpythonb48aeb097432 -- nosy: +georg.brandl title: test issue - new commit ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2771] new commit
Georg Brandl ge...@python.org added the comment: test the roundup hook again http://hg.python.org/cpython/dfc4a58fc2d4 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2771] Test issue
Changes by Georg Brandl ge...@python.org: -- title: new commit - Test issue ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2771] Test issue
Georg Brandl ge...@python.org added the comment: test the roundup hook another time http://hg.python.org/cpython/65f5077e877b -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2771] Test issue
Georg Brandl ge...@python.org added the comment: test the roundup hook another time http://hg.python.org/cpython/8f21aec26226 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2771] Test issue
Georg Brandl ge...@python.org added the comment: test the roundup hook another time http://hg.python.org/cpython/502f0683b161 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue670664] HTMLParser.py - more robust SCRIPT tag parsing
Alexander b3n...@yandex.ru added the comment: This is small patch for related bug issue9577 which actually is not related to this bug. -- nosy: +friday Added file: http://bugs.python.org/file21045/cdata_patch.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue670664 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2771] Test issue
Georg Brandl ge...@python.org added the comment: : test the refactored roundup hook. http://hg.python.org/cpython/cd21195d07ca -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2771] Test issue
Changes by Georg Brandl ge...@python.org: -- status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2271] msi installs to the incorrect location (C drive)
Georg Brandl ge...@python.org added the comment: finally fixing issue 2271: yay! http://hg.python.org/cpython/add991f6527a -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2271 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2271] msi installs to the incorrect location (C drive)
Changes by Georg Brandl ge...@python.org: -- Removed message: http://bugs.python.org/msg130321 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2271 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2771] Test issue
Antoine Pitrou pit...@free.fr added the comment: re bug 2771 -- testing the roundup hook. http://hg.python.org/cpython/c37da7946f2b -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2771] Test issue
Changes by Georg Brandl ge...@python.org: -- nosy: -ezio.melotti, pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2771] Test issue
Georg Brandl ge...@python.org added the comment: finally fixing issue 2771: yay! http://hg.python.org/cpython/440238c16a7a -- resolution: invalid - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue670664] HTMLParser.py - more robust SCRIPT tag parsing
Alexander b3n...@yandex.ru added the comment: And this patch fix the both bugs in more elegant way -- Added file: http://bugs.python.org/file21046/cdata_patch.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue670664 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11298] unittest discovery needs better explanation
Changes by Ezio Melotti ezio.melo...@gmail.com: -- assignee: docs@python - ezio.melotti stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11072] Add MLSD command support to ftplib
SilentGhost ghost@gmail.com added the comment: Here is a patch incorporating some of the changes proposed by Eric: * drop callback, return generator of (filename, fact-dict) Aren't you modifying the state on the server (via OPTS MLST), and then if you make a subsequent call without specifying facts you'll be using the value of facts from the previous call to MLSD? I don't think that's desirable, but short of calling OPTS MLST every time (possibly with the results of an initial FEAT) there's no way around it. This is the behaviour according to RFC. MLSD will return the set of facts, until a new OPTS MLST issued. I don't like the isdigit test. Shouldn't this decision be left to the caller? What if a fact happens to look like an integer some of the time, but not always? Maybe unique is a hex string. I don't think you'd want it converted to an int on the occasions where it was all decimal digits, but a string otherwise. Also look at your modify facts. Those are not very useful as ints. Drop the isdigit test: some value such as timestamps ('modify') might be digits for one files and would remain strings for the others. If a fact=value string does not have an '=', you silently ignore it. I'd rather this raise an exception and not pass silently. It's not compliant. You should have a test for this. I don't think it should raise an error, i'd rather just pass it to the caller. There is a wide variety of possible non-compliant responses. For example there is a rigid format for time stamps, do we have to check for that? One thing, that my patch doesn't do at the moment, but I think would be useful is to normalise all fact names to lower case. What do you think? I hope that MLSD_DATA now covers wider range of cases (it's from http://tools.ietf.org/html/rfc3659#section-7.7.4). Note that server MUST NOT return facts that weren't requested. What would be the return values check here? -- Added file: http://bugs.python.org/file21047/issue11072.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11072 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2771] Test issue
Antoine Pitrou pit...@free.fr added the comment: re bug 2771 -- testing the roundup hook. http://hg.python.org/cpython/c37da7946f2b Looks like this URL misses the /rev/ before the changeset id. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9269] Cannot pickle self-referencing sets
Changes by bcroq bertrand.c...@gmail.com: -- nosy: +bcroq ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9269 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1062277] Pickle breakage with reduction of recursive structures
Changes by bcroq bertrand.c...@gmail.com: -- nosy: +bcroq ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1062277 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4033] python search path - .pth recursion
Changes by Graham Wideman initcont...@grahamwideman.com: -- nosy: +gwideman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9291] mimetypes initialization fails on Windows because of non-Latin characters in registry
Changes by Francis Devereux python@devrx.org: -- nosy: +frankoid ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9291 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11413] Idle doesn't start
Chris ceonnbo...@yahoo.com added the comment: Can you please guide me step by step - how and where exactly do I open a command prompt?  --- On Mon, 3/7/11, Amaury Forgeot d'Arc rep...@bugs.python.org wrote: From: Amaury Forgeot d'Arc rep...@bugs.python.org Subject: [issue11413] Idle doesn't start To: ceonnbo...@yahoo.com Date: Monday, March 7, 2011, 4:26 PM Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Can you open a command prompt, and type:    c:\python32\python.exe -m idlelib.idle If there are messages, please paste them here! -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11413 ___ -- Added file: http://bugs.python.org/file21048/unnamed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11413 ___table cellspacing=0 cellpadding=0 border=0 trtd valign=top style=font: inherit;DIVCan you please guide menbsp;step by step - how and where exactly do I open a command prompt?/DIV DIVnbsp;/DIV DIVBRBR--- On BMon, 3/7/11, Amaury Forgeot d'Arc Ilt;rep...@bugs.python.orggt;/I/B wrote:BR/DIV BLOCKQUOTE style=PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solidBRFrom: Amaury Forgeot d'Arc lt;rep...@bugs.python.orggt;BRSubject: [issue11413] Idle doesn't startBRTo: ceonnbo...@yahoo.comBRDate: Monday, March 7, 2011, 4:26 PMBRBR DIV class=plainMailBRAmaury Forgeot d'Arc lt;A href=http://us.mc598.mail.yahoo.com/mc/compose?to=amaur...@gmail.com; ymailto=mailto:amaur...@gmail.com;amaur...@gmail.com/Agt; added the comment:BRBRCan you open a command prompt, and type:BRnbsp;nbsp;nbsp;c:\python32\python.exe -m idlelib.idleBRIf there are messages, please paste them here!BRBR--BRnosy: +amaury.forgeotdarcBRBR___BRPython tracker lt;A href=http://us.mc598.mail.yahoo.com/mc/compose?to=rep...@bugs.python.org; ymailto=mailto:rep...@bugs.python.org;rep...@bugs.python.org/Agt;BRlt;A href=http://bugs.python.org/issue11413; target=_blankhttp://bugs.python.org/issue11413/Agt;BR___BR/DIV/BLOCKQUOTE/td/tr/tablebr ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11298] unittest discovery needs better explanation
Ezio Melotti ezio.melo...@gmail.com added the comment: #11298: Improve the unittest discovery explanation. http://hg.python.org/cpython/rev/bbf8a8a1af17 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11413] Idle doesn't start
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: - Click the Start button - On this menu, click the Run... item (almost at the bottom) - In the small windows that opens, type cmd and click OK. This opens the command prompt. - In this window, type: c:\python32\python.exe -m idlelib.idle To copy the output, you can open the menu by clicking on the icon on the top-left corner of the window; select Edit, Select All and press Enter to copy all the window text into the clipboard. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11413 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9291] mimetypes initialization fails on Windows because of non-Latin characters in registry
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9291 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11433] syntax error at while statement in IDLE/python shell
Changes by SilentGhost ghost@gmail.com: -- status: pending - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11433 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11298] unittest discovery needs better explanation
Ezio Melotti ezio.melo...@gmail.com added the comment: #11298: merge from 3.2. http://hg.python.org/cpython/rev/fa23f323d747 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11413] Idle doesn't start
Chris ceonnbo...@yahoo.com added the comment: Thank you, here is the message I got:   Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Ceonnc:\python32\python.exe -m idlelib.idle Traceback (most recent call last):  File c:\python32\lib\runpy.py, line 160, in _run_module_as_main    __main__, fname, loader, pkg_name)  File c:\python32\lib\runpy.py, line 73, in _run_code    exec(code, run_globals)  File c:\python32\lib\idlelib\idle.py, line 11, in module    idlelib.PyShell.main()  File c:\python32\lib\idlelib\PyShell.py, line 1374, in main    root = Tk(className=Idle)  File c:\python32\lib\tkinter\__init__.py, line 1674, in __init__    self.tk = _tkinter.create(screenName, baseName, className, interactive, want objects, useTk, sync, use) _tkinter.TclError: Can't find a usable init.tcl in the following directories:    {C:\IBMTOOLS\Python22\tcl\tcl8.4} C:/IBMTOOLS/Python22/tcl/tcl8.5 c:/python3 2/lib/tcl8.5 c:/lib/tcl8.5 c:/lib/tcl8.5 c:/library c:/library c:/tcl8.5.9/libra ry c:/tcl8.5.9/library C:/IBMTOOLS/Python22/tcl/tcl8.4/init.tcl: version conflict for package Tcl: ha ve 8.5.9, need exactly 8.4 version conflict for package Tcl: have 8.5.9, need exactly 8.4    while executing package require -exact Tcl 8.4    (file C:/IBMTOOLS/Python22/tcl/tcl8.4/init.tcl line 19)    invoked from within source C:/IBMTOOLS/Python22/tcl/tcl8.4/init.tcl    (uplevel body line 1)    invoked from within uplevel #0 [list source $tclfile] This probably means that Tcl wasn't installed properly. --- On Tue, 3/8/11, Amaury Forgeot d'Arc rep...@bugs.python.org wrote: From: Amaury Forgeot d'Arc rep...@bugs.python.org Subject: [issue11413] Idle doesn't start To: ceonnbo...@yahoo.com Date: Tuesday, March 8, 2011, 9:26 AM Amaury Forgeot d'Arc amaur...@gmail.com added the comment: - Click the Start button - On this menu, click the Run... item (almost at the bottom) - In the small windows that opens, type cmd and click OK. This opens the command prompt. - In this window, type:   c:\python32\python.exe -m idlelib.idle To copy the output, you can open the menu by clicking on the icon on the top-left corner of the window; select Edit, Select All and press Enter to copy all the window text into the clipboard. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11413 ___ -- Added file: http://bugs.python.org/file21049/unnamed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11413 ___table cellspacing=0 cellpadding=0 border=0 trtd valign=top style=font: inherit;DIVThank you, here is the message I got:/DIV DIVnbsp;/DIV DIVnbsp;/DIV DIVMicrosoft Windows XP [Version 5.1.2600]BR(C) Copyright 1985-2001 Microsoft Corp./DIV DIVC:\Documents and Settings\Ceonngt;c:\python32\python.exe -m idlelib.idleBRTraceback (most recent call last):BRnbsp; File c:\python32\lib\runpy.py, line 160, in _run_module_as_mainBRnbsp;nbsp;nbsp; __main__, fname, loader, pkg_name)BRnbsp; File c:\python32\lib\runpy.py, line 73, in _run_codeBRnbsp;nbsp;nbsp; exec(code, run_globals)BRnbsp; File c:\python32\lib\idlelib\idle.py, line 11, in lt;modulegt;BRnbsp;nbsp;nbsp; idlelib.PyShell.main()BRnbsp; File c:\python32\lib\idlelib\PyShell.py, line 1374, in mainBRnbsp;nbsp;nbsp; root = Tk(className=Idle)BRnbsp; File c:\python32\lib\tkinter\__init__.py, line 1674, in __init__BRnbsp;nbsp;nbsp; self.tk = _tkinter.create(screenName, baseName, className, interactive, wantBRobjects, useTk, sync, use)BR_tkinter.TclError: Can't find a usable init.tcl in the following directories:BRnbsp;nbsp;nbsp; {C:\IBMTOOLS\Python22\tcl\tcl8.4} C:/IBMTOOLS/Python22/tcl/tcl8.5 c:/python3BR2/lib/tcl8.5 c:/lib/tcl8.5 c:/lib/tcl8.5 c:/library c:/library c:/tcl8.5.9/libraBRry c:/tcl8.5.9/library/DIV DIVC:/IBMTOOLS/Python22/tcl/tcl8.4/init.tcl: version conflict for package Tcl: haBRve 8.5.9, need exactly 8.4BRversion conflict for package Tcl: have 8.5.9, need exactly 8.4BRnbsp;nbsp;nbsp; while executingBRpackage require -exact Tcl 8.4BRnbsp;nbsp;nbsp; (file C:/IBMTOOLS/Python22/tcl/tcl8.4/init.tcl line 19)BRnbsp;nbsp;nbsp; invoked from withinBRsource C:/IBMTOOLS/Python22/tcl/tcl8.4/init.tclBRnbsp;nbsp;nbsp; (uplevel body line 1)BRnbsp;nbsp;nbsp; invoked from withinBRuplevel #0 [list source $tclfile]/DIV DIVBRThis probably means that Tcl wasn't installed properly./DIV DIVBRBRBRBR--- On BTue, 3/8/11, Amaury Forgeot d'Arc Ilt;rep...@bugs.python.orggt;/I/B wrote:BR/DIV BLOCKQUOTE style=PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solidBRFrom: Amaury Forgeot d'Arc lt;rep...@bugs.python.orggt;BRSubject: [issue11413] Idle doesn't startBRTo: ceonnbo...@yahoo.comBRDate: Tuesday, March 8, 2011, 9:26 AMBRBR DIV class=plainMailBRAmaury
[issue11298] unittest discovery needs better explanation
Ezio Melotti ezio.melo...@gmail.com added the comment: #11298: Improve the unittest discovery explanation. http://hg.python.org/cpython/rev/88b5a93b1725 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com