Re: Python Programming - 28 hours training in New York for $3999
On 01/26/2013 06:57 PM, Chris Angelico wrote: On Sun, Jan 27, 2013 at 3:38 AM, Juhani Karlsson juhani.karls...@talvi.com wrote: Or take this course for free and buy 500 lunches. Your choice. You spend $8 on lunch? Wow, that's taking TANSTAAFL a long way... ChrisA MYCROFTXXX I remember when lunches at IBM were never more than $1 -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Algorithm. Tony Gaddis book 2 Starting python3
On Sunday 27 January 2013 13:05:27 george...@talktalk.net did opine: Message additions Copyright Sunday 27 January 2013 by Gene Heskett Hi Question 3 Chp2 Page 76 Adds2 to a and assigns the result to b. I have several attemtps,would like to check my answer.help please At 80 i need all the help i can find. Thanks George Smart sniff, sobs Darn, I've just been dethroned from my resident oldest fart on this list throne, I'm only 78. Cheers, Gene -- There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. -Ed Howdershelt (Author) My web page: http://coyoteden.dyndns-free.com:85/gene is up! My views http://www.armchairpatriot.com/What%20Has%20America%20Become.shtml Thyme's Law: Everything goes wrong at once. I was taught to respect my elders, but its getting harder and harder to find any... -- http://mail.python.org/mailman/listinfo/python-list
Re: Need Pattern For Logging Into A Website
On Friday, January 25, 2013 2:29:51 AM UTC+1, Tim Daneliuk wrote: I need to write a Python script to do the following: - Connect to a URL and accept any certificate - self-signed or authoritative - Provide login name/password credentials - Fill in some presented fields - Hit a Submit button Why? Because I don't want to have to start a browser and do this interactively every time I authenticate with a particular server. I want to do this at the command line with no interactive intervention. I know Python pretty well. I don't quite know how to do this and was hoping someone had a simple pattern they could share for doing this. TIA, Hello Tim, I think you may also want to take a look at python requests. http://docs.python-requests.org/en/latest/user/advanced/ From my experience they do a much nicer job than urllib and anything I've tried. You will probably get what you want out of them easily and in no time. -- cheers, john -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting a column's value output
Τη Κυριακή, 27 Ιανουαρίου 2013 10:50:33 μ.μ. UTC+2, ο χρήστης Mitya Sirenef έγραψε: On 01/27/2013 03:24 PM, οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½ οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½ wrote: οΏ½οΏ½ οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½, 27 οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½ 2013 9:12:16 οΏ½.οΏ½. UTC+2, οΏ½ οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½ ru...@yahoo.com οΏ½οΏ½οΏ½οΏ½οΏ½οΏ½: python code Yes indeed, there is no need to use a loop since i know the exact number of items i'am expecting. Thanks you very much for clarifying this to me: One last thing i want to ask you: try: cur.execute( '''SELECT host, userOS, browser, hits, lastvisit FROM visitors WHERE counterID = (SELECT ID FROM counters WHERE URL = %s) ORDER BY lastvisit DESC''', (htmlpage,) ) except MySQLdb.Error, e: print ( Query Error: , sys.exc_info()[1].excepinfo()[2] ) else: data = cur.fetchall() for host, useros, browser, hits, lastvisit in data: print ( tr ) for item in host, useros, browser, hits, lastvisit.strftime('%A %e %b, %H:%M').decode('cp1253').encode('utf8'): print ( tdcenterbfont color=white %s /td % item ) sys.exit(0) === That would be also written as: for row in data: print (tr) for item in row: print( blah blah blah ) And that would make the code easier to read and more clear, but its that 'lastvisit' column's value than needs formating,hence it makes me use the above syntax. Is there any simpler way to write the above working code without the need to specify all of the columns' names into the loop? You can write: for row in data: print (tr) row = list(row) row[-1] = row[-1].strftime(...) for item in row: print( blah blah blah ) - mitya -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ The existence of any evil anywhere at any time absolutely ruins a total optimism. George Santayana Thank you very much, your solution makes the code looks so much clearer! -- http://mail.python.org/mailman/listinfo/python-list
Re: Formatting a column's value output
Τη Δευτέρα, 28 Ιανουαρίου 2013 12:27:12 π.μ. UTC+2, ο χρήστης ru...@yahoo.com έγραψε: On 01/27/2013 01:50 PM, Mitya Sirenef wrote: On 01/27/2013 03:24 PM, Κώστας Παπαδόπουλος wrote: Τη Κυριακή, 27 Ιανουαρίου 2013 9:12:16 μ.μ. UTC+2, ο χρήστης ru...@yahoo.com έγραψε: python code Yes indeed, there is no need to use a loop since i know the exact number of items i'am expecting. Thanks you very much for clarifying this to me: One last thing i want to ask you: try: cur.execute( '''SELECT host, userOS, browser, hits, lastvisit FROM visitors WHERE counterID = (SELECT ID FROM counters WHERE URL = %s) ORDER BY lastvisit DESC''', (htmlpage,) ) except MySQLdb.Error, e: print ( Query Error: , sys.exc_info()[1].excepinfo()[2] ) else: data = cur.fetchall() for host, useros, browser, hits, lastvisit in data: print ( tr ) for item in host, useros, browser, hits, lastvisit.strftime('%A %e %b, %H:%M').decode('cp1253').encode('utf8'): print ( tdcenterbfont color=white %s /td % item ) sys.exit(0) === That would be also written as: for row in data: print (tr) for item in row: print( blah blah blah ) And that would make the code easier to read and more clear, but its that 'lastvisit' column's value than needs formating,hence it makes me use the above syntax. Is there any simpler way to write the above working code without the need to specify all of the columns' names into the loop? You can write: for row in data: print (tr) row = list(row) row[-1] = row[-1].strftime(...) for item in row: print( blah blah blah ) Or alternatively, for row in data: print (tr) for item_num, item in enumerate (row): if item_num != len(row) - 1: print( blah blah blah ) else: print( item.strftime(...) ) Or, being a little clearer, LASTVISIT_POS = 4 for row in data: print (tr) for item_num, item in enumerate (row): if item_num != LASTVISIT_POS: print( blah blah blah ) else: print( item.strftime(...) ) Thank you very much, your alternatives are great but i think i'll use Mity'as solution, its more easy to me. Thank you very much! -- http://mail.python.org/mailman/listinfo/python-list
Re: [SPAM] Fonts Tinker
Dnia 2013-01-25, pią o godzinie 20:41 -0800, Angel pisze: but the real displayed fonts in the window are smaller (default size of 12, maybe). Am I missing something? Thanks in advance, A. Did you tried this by simple: --- root = Tk() root.option_add('*Font', Heveltica 14) --- We'll see if it's a local tkinter installation problem. -- Łukasz Posadowski -- http://mail.python.org/mailman/listinfo/python-list
Reading file issue
I am parseing a file to extract data, but am seeing the file being updated even though I never explicitly write to the file. It is possible that another process is doing this at some later time, but I just want to check that opening the file as follows and ignoring a record would not result in that record being removed from the file. I'm damned sure it wouldn't, but just wanted to check with the experts!. for line in open(/home/john/myfile): linecount = linecount + 1 if linecount == 1: # ignore header continue -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading file issue
On Mon, Jan 28, 2013 at 10:47 PM, loial jldunn2...@gmail.com wrote: I am parseing a file to extract data, but am seeing the file being updated even though I never explicitly write to the file. It is possible that another process is doing this at some later time, but I just want to check that opening the file as follows and ignoring a record would not result in that record being removed from the file. I'm damned sure it wouldn't, but just wanted to check with the experts!. for line in open(/home/john/myfile): Absolutely not. You're opening the file (by default) for reading only. That's not going to edit the file in any way. (It might cause the directory entry to be rewritten, eg last-access time, but not the file contents.) Your expectation is 100% correct. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading file issue
Thanks for confirming my sanity On Monday, 28 January 2013 11:57:43 UTC, Chris Angelico wrote: On Mon, Jan 28, 2013 at 10:47 PM, loial jldunn2...@gmail.com wrote: I am parseing a file to extract data, but am seeing the file being updated even though I never explicitly write to the file. It is possible that another process is doing this at some later time, but I just want to check that opening the file as follows and ignoring a record would not result in that record being removed from the file. I'm damned sure it wouldn't, but just wanted to check with the experts!. for line in open(/home/john/myfile): Absolutely not. You're opening the file (by default) for reading only. That's not going to edit the file in any way. (It might cause the directory entry to be rewritten, eg last-access time, but not the file contents.) Your expectation is 100% correct. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading file issue
On 28 January 2013 11:47, loial jldunn2...@gmail.com wrote: I am parseing a file to extract data, but am seeing the file being updated even though I never explicitly write to the file. It is possible that another process is doing this at some later time, but I just want to check that opening the file as follows and ignoring a record would not result in that record being removed from the file. I'm damned sure it wouldn't, but just wanted to check with the experts!. for line in open(/home/john/myfile): The line above opens the file in read-only mode. It's not possible to make changes to the file if you only open it in read-only mode. So no this code is not modifying the file. It is, however, slightly better to write the above as with open('/home/john/myfile') as fin: for line in fin: # stuff This is better as the with statement handles errors better than just calling open directly. linecount = linecount + 1 if linecount == 1: # ignore header continue Another way of achieving this would be to do: headerline = fin.readline() for line in fin: # No need to worry about that header line now Oscar -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading file issue
On Mon, 28 Jan 2013 03:47:07 -0800 (PST) loial jldunn2...@gmail.com wrote: I am parseing a file to extract data, but am seeing the file being updated even though I never explicitly write to the file. It is possible that another process is doing this at some later time, but I just want to check that opening the file as follows and ignoring a record would not result in that record being removed from the file. The only complication I'd see would be the reader bombing out because the writer process is in the middle of writing. A quick test on WinXP showed that it's possible to continue to write to a file that another process has open for reading (this shouldn't be an issue on POSIX OSes; Win32 can be a bit more fascist about sharing files, especially if they're both open for writing). However, that doesn't alter the data written, so all it takes is just re-running the reader process. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Hello All
I have been learning Python on my own and its been 1yr now and i still feel i dont know anything, is there a way that i can use to increase my way of learning. I feel there is more that i can do with python that other languages cannot. Please help. -- http://mail.python.org/mailman/listinfo/python-list
Re: Hello All
On 01/28/2013 07:34 AM, Huey Mataruse wrote: I have been learning Python on my own and its been 1yr now and i still feel i dont know anything, is there a way that i can use to increase my way of learning. I feel there is more that i can do with python that other languages cannot. Please help. Welcome to Python. Nothing wrong with learning Python on your own, but if you feel you haven't made much progress in a year, perhaps your approach is inadequate, or perhaps you need more discipline in applying it. Or maybe you actually know more than your realize. If you could be specific in some concept that escapes you, maybe we could give some specific help. First, your background. Are you fluent in any other languages? Have you any college training in any particular computer skills? Do you use them in your work, or what? Next, what have you been doing to actually try to learn? Have you worked through a tutorial, and I mean really worked through it, writing programs for every exercise, not just read it, and hoped it'd stick? If so, which tutorial? Finally, what version of Python are you learning, and on what OS can you play? Do you actually have it installed, or is this book learning? Do you work in an environment where you could write an occasional utility in your own choice of language? Or does it all need to be on your own time? tu...@python.org is generally better suited for beginner's questions than python-list. But since you're already here... -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Arpex Capital Seleciona: Desenvolvedor Python/Django Sênior RJ
Arpex Capital seleciona para uma de suas startups: Desenvolvedor Python/Django Sênior Estamos em busca daqueles(as) que: acham que meritocracia é indispensável, programam desde a infância, possuem sede por aprender e programar e querem trabalhar muito para fazer algo especial! O desenvolvedor estará envolvido em um projeto Python/Django para uma das startups da ArpexCapital (fundo de investimentos americano com foco no mercado brasileiro). Skills necessários: Python, HTML, MySQL Skills desejáveis (bônus): Framework Django, Javascript, Linux, Scrum ou XP Local de Trabalho: Centro/RJ Os interessados deverão enviar o CV com pretensão salarial para kgar...@arpexcapital.com.br, mencionando no assunto Desenvolvedor Python/Django Sênior. -- http://mail.python.org/mailman/listinfo/python-list
software app and Python: any experience?
Hi guys, I am thinking of driving a DJ application from Python. I am running Linux and I found the Mixxx app. Does anyone know if there are python bindings, or if this is possible at all? or does anyone have experience with another software that does the same DJ thing? I have also found the pymixxx module that I could install... but I didn't find any documentation so far or example code that could help me start (I'm keeping on searching). Finally maybe that there is any DJ app that could be driven by pygame.midi? Any idea appreciated. Sorry to fail to be more specific. Mik -- http://mail.python.org/mailman/listinfo/python-list
Reading data from 2 different files and writing to a single file
In the code below I am trying to read 2 files f1 and f2 , extract some data from them and then trying to write them into a single file that is 'nf'. import cv f1 = open(rZ:\modules\Feature_Vectors_300.arff) f2 = open(rZ:\modules\Feature_Vectors_300_Pclass.arff) nf = open(rZ:\modules\trial.arff, w) for l in f1: sp = l.split(,) if len(sp)!= 12: continue else: ix = sp[0].strip() iy = sp[1].strip() print ix, iy for s in f2: st = s.split(,) if len(st)!= 11: continue else: clas = st[10].strip() print ix, iy, clas print nf, ix, iy, clas f1.close() f2.close() nf.close() I think my code is not so correct , as I am not getting desired results and logically it follows also but I am stuck , cannot find a way around this simple problem of writing to a same file.. Please suggest some good pythonic way I can do it.. Thanks in Advance -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading data from 2 different files and writing to a single file
On Tue, Jan 29, 2013 at 12:31 AM, inshu chauhan insidesh...@gmail.com wrote: I think my code is not so correct , as I am not getting desired results... Firstly, what results are you getting, and what are you desiring? It helps to be clear with that. import cv What module is this? Do you need it? Does it affect things? It's not a Python standard library module, as far as I know. for l in f1: else: print ix, iy for s in f2: This will bomb immediately with an IndentationError. I can't be sure whether you intended for the loops to be nested or not. One of the consequences of Python's use of indentation to define blocks is that you have to be really careful when you copy and paste. (Which bit me somewhat this weekend; I tried to share some Python code via a spreadsheet, and it mangled the leading whitespace. Very tiresome.) Can you try pasting in your actual code, please? Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading data from 2 different files and writing to a single file
- Original Message - - Original Message - In the code below I am trying to read 2 files f1 and f2 , extract some data from them and then trying to write them into a single file that is 'nf'. [snip code] I think my code is not so correct , as I am not getting desired results and logically it follows also but I am stuck , cannot find a way around this simple problem of writing to a same file.. Please suggest some good pythonic way I can do it.. Thanks in Advance Hi, What result do you expect ? can you provide the 2 first lines of f1 and f2, and finally what is the exact error you are experiencing ? Cheers, JM Resending to the list, I replied to the OP by mistake. JM -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-ideas] while conditional in list comprehension ??
On Tue, Jan 29, 2013 at 12:33 AM, Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de wrote: Why not extend this filtering by allowing a while statement in addition to if, as in: [n for n in range(1,1000) while n 400] The time machine strikes again! Check out itertools.takewhile - it can do pretty much that: import itertools [n for n in itertools.takewhile(lambda n: n400, range(1,1000))] It's not quite list comp notation, but it works. [n for n in itertools.takewhile(lambda n: n40, range(1,100))] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39] ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-ideas] while conditional in list comprehension ??
Argh, sorry folks. Hit the wrong list. :( On Tue, Jan 29, 2013 at 12:55 AM, Chris Angelico ros...@gmail.com wrote: On Tue, Jan 29, 2013 at 12:33 AM, Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de wrote: Why not extend this filtering by allowing a while statement in addition to if, as in: [n for n in range(1,1000) while n 400] The time machine strikes again! Check out itertools.takewhile - it can do pretty much that: import itertools [n for n in itertools.takewhile(lambda n: n400, range(1,1000))] It's not quite list comp notation, but it works. [n for n in itertools.takewhile(lambda n: n40, range(1,100))] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39] ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading data from 2 different files and writing to a single file
On 01/28/2013 08:31 AM, inshu chauhan wrote: In the code below I am trying to read 2 files f1 and f2 , extract some data from them and then trying to write them into a single file that is 'nf'. import cv f1 = open(rZ:\modules\Feature_Vectors_300.arff) f2 = open(rZ:\modules\Feature_Vectors_300_Pclass.arff) nf = open(rZ:\modules\trial.arff, w) for l in f1: sp = l.split(,) if len(sp)!= 12: continue else: ix = sp[0].strip() iy = sp[1].strip() print ix, iy for s in f2: st = s.split(,) if len(st)!= 11: continue else: clas = st[10].strip() print ix, iy, clas print nf, ix, iy, clas f1.close() f2.close() nf.close() I think my code is not so correct , as I am not getting desired results and logically it follows also but I am stuck , cannot find a way around this simple problem of writing to a same file.. Please suggest some good pythonic way I can do it.. Thanks in Advance The other questions are useful, but I'll make a guess based on what you've said so far. You're trying to read the same file f2 multiple times, as you loop around the f1 file. But you just keep the file open and try to iterate over it multiple times. You either need to close and open it each time, or do a seek to beginning, or you'll not see any data for the second and later iteration. Or better, just read file f2 into a list, and iterate over that, which you can do as many times as you like. (Naturally this assumes it's not over a couple of hundred meg). file2 = open(rZ:\modules\Feature_Vectors_300_Pclass.arff) f2 = file2.readlines() file2.close() -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading data from 2 different files and writing to a single file
Yes Chris, I understand, My Original code was for l in f1: sp = l.split(,) if len(sp)!= 12: continue else: ix = sp[0].strip() iy = sp[1].strip() for s in f2: st = s.split(,) if len(st)!= 11: continue else: clas = st[10].strip() print ix, iy, clas print nf, ix, iy, clas f1.close() f2.close() nf.close() where f1 contains something like : 297, 404, , 298, 404, , .. 299, 404, . . .. 295, 452, and f2 contains something like : 7 . 2 2 .7 and what I want to be written in the new file i.e. nf is something like: 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 2 297 404 2 297 404 2 297 404 2 297 404 2 which m getting but partially correct because only last value is changing not the first two... which should not happen.. In every loop all the three values should change.. -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading data from 2 different files and writing to a single file
On Tue, Jan 29, 2013 at 1:12 AM, inshu chauhan insidesh...@gmail.com wrote: where f1 contains something like : 297, 404, , 298, 404, , .. 299, 404, . . .. 295, 452, and f2 contains something like : 7 . 2 2 .7 and what I want to be written in the new file i.e. nf is something like: 297 404 7 297 404 2 which m getting but partially correct because only last value is changing not the first two... which should not happen.. In every loop all the three values should change.. In that case, Dave's suggestion to read into a list and iterate over the list is to be strongly considered. But I'm not entirely sure what your goal is here. Are you trying to make the Cartesian product of the two files, where you have one line in the output for each possible pair of matching lines? That is, for each line in the first file, you make a line in the output for each line in the second? That's what your code will currently do. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading data from 2 different files and writing to a single file
In that case, Dave's suggestion to read into a list and iterate over the list is to be strongly considered. But I'm not entirely sure what your goal is here. Are you trying to make the Cartesian product of the two files, where you have one line in the output for each possible pair of matching lines? That is, for each line in the first file, you make a line in the output for each line in the second? That's what your code will currently do. No , I dont want that , actually both files have equal no of lines, I want to read the first line of f1 , take 2 datas from it, nd then read first line of f2, take data from it, then print them to the same first line of new file i.e nf. ChrisA -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading data from 2 different files and writing to a single file
On Tue, Jan 29, 2013 at 1:24 AM, inshu chauhan insidesh...@gmail.com wrote: In that case, Dave's suggestion to read into a list and iterate over the list is to be strongly considered. But I'm not entirely sure what your goal is here. Are you trying to make the Cartesian product of the two files, where you have one line in the output for each possible pair of matching lines? That is, for each line in the first file, you make a line in the output for each line in the second? That's what your code will currently do. No , I dont want that , actually both files have equal no of lines, I want to read the first line of f1 , take 2 datas from it, nd then read first line of f2, take data from it, then print them to the same first line of new file i.e nf. Okay, so you want an algorithm something like this: for l1 in f1: # make sure you have the right sort of line, and 'continue' if not for l2 in f2: # same again, 'continue' if not right print nf # whatever you need to output break The 'break' in the second loop will mean that it never consumes more than one valid line. You still need to deal with the possibilities of one file being shorter than the other, of the lines mismatching, etc, but at least you don't get a failed Cartesian product. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading data from 2 different files and writing to a single file
On 01/28/2013 09:12 AM, inshu chauhan wrote: Yes Chris, I understand, My Original code was for l in f1: sp = l.split(,) if len(sp)!= 12: continue else: ix = sp[0].strip() iy = sp[1].strip() for s in f2: st = s.split(,) if len(st)!= 11: continue else: clas = st[10].strip() print ix, iy, clas print nf, ix, iy, clas f1.close() f2.close() nf.close() where f1 contains something like : 297, 404, , 298, 404, , .. 299, 404, . . .. 295, 452, and f2 contains something like : 7 . 2 2 .7 and what I want to be written in the new file i.e. nf is something like: 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 7 297 404 2 297 404 2 297 404 2 297 404 2 297 404 2 which m getting but partially correct because only last value is changing not the first two... which should not happen.. In every loop all the three values should change.. Your current logic tries to scan through the first file, and for each line that has 12 elements, scans through the entire second file. It fails to actually do it, because you never do a seek on the second file. Now it appears your requirement is entirely different. I believe you have two text files each having the same number of lines. You want to loop through the pair of lines (once from each file, doing some kind of processing and printing). If that's the case, your nested loop is the wrong thing, and you can forget my caveat about nesting file reads. What you want is the zip() function for l,s in zip(f1, f2): #you now have one line from each file, # which you can then validate and process Note, this assumes that when a line is bad from either file, you're going to also ignore the corresponding line from the other. If you have to accommodate variable misses in the lining up, then your work is *much* harder. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading data from 2 different files and writing to a single file
On Tue, Jan 29, 2013 at 1:37 AM, Dave Angel d...@davea.name wrote: What you want is the zip() function for l,s in zip(f1, f2): #you now have one line from each file, # which you can then validate and process Note, this assumes that when a line is bad from either file, you're going to also ignore the corresponding line from the other. If you have to accommodate variable misses in the lining up, then your work is *much* harder. Much harder? Not really - see my solution above with a simple 'break'. Much less clear what's going on, though, it is. Iterating together over both files with zip is much cleaner. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading data from 2 different files and writing to a single file
Your current logic tries to scan through the first file, and for each line that has 12 elements, scans through the entire second file. It fails to actually do it, because you never do a seek on the second file. Now it appears your requirement is entirely different. I believe you have two text files each having the same number of lines. You want to loop through the pair of lines (once from each file, doing some kind of processing and printing). If that's the case, your nested loop is the wrong thing, and you can forget my caveat about nesting file reads. What you want is the zip() function for l,s in zip(f1, f2): #you now have one line from each file, # which you can then validate and process Note, this assumes that when a line is bad from either file, you're going to also ignore the corresponding line from the other. If you have to accommodate variable misses in the lining up, then your work is *much* harder. Actually these are Arff files used in Weka (Data Mining ), So they have a certain amount of header information which is the same in both files(in same no. of lines too ) and both files have equal lines, So when I read basically In both files I am trying to ignore the Header information. then it is like reading first line from f1 and first line from f2, extracting the data I want from each file and simply write it to a third file line by line... What does actually Zip function do ? Thanks and Regards -- http://mail.python.org/mailman/listinfo/python-list
RE: Reading data from 2 different files and writing to a single file
Hi, as many others I am not exactly sure what the purpose of your code really is. However, if what you´re trying to do here is to take one line from f1, one line from f2 and then write some combined data to nf, it is not surprising that you're not getting what you expect (the main reason being that your for loops are nested, as pointed out already). In that case, a much cleaner and less error-prone solution would be iterator-zipping, leaving you with just one for loop that is easy to understand: for l,s in zip(f1,f2): # now l holds the next line from f1, s the corresponding line from f2 do_yourstuf() write_output() if your files are large, then in python 2.x you should use: import itertools for l,s in itertools.izip(f1,f2): do_yourstuff() write_output() The reason for this is that before python 3 zip gathered and returned your results as an in-memory list. itertools.izip and the built-in python 3 zip return iterators. Hope that helps, Wolfgang From: inshu chauhan [mailto:insidesh...@gmail.com] Sent: Monday, January 28, 2013 2:32 PM To: python-list@python.org Subject: Reading data from 2 different files and writing to a single file In the code below I am trying to read 2 files f1 and f2 , extract some data from them and then trying to write them into a single file that is 'nf'. import cv f1 = open(rZ:\modules\Feature_Vectors_300.arff) f2 = open(rZ:\modules\Feature_Vectors_300_Pclass.arff) nf = open(rZ:\modules\trial.arff, w) for l in f1: sp = l.split(,) if len(sp)!= 12: continue else: ix = sp[0].strip() iy = sp[1].strip() print ix, iy for s in f2: st = s.split(,) if len(st)!= 11: continue else: clas = st[10].strip() print ix, iy, clas print nf, ix, iy, clas f1.close() f2.close() nf.close() I think my code is not so correct , as I am not getting desired results and logically it follows also but I am stuck , cannot find a way around this simple problem of writing to a same file.. Please suggest some good pythonic way I can do it.. Thanks in Advance -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading data from 2 different files and writing to a single file
On 01/28/2013 09:47 AM, inshu chauhan wrote: Your current logic tries to scan through the first file, and for each line that has 12 elements, scans through the entire second file. It fails to actually do it, because you never do a seek on the second file. Now it appears your requirement is entirely different. I believe you have two text files each having the same number of lines. You want to loop through the pair of lines (once from each file, doing some kind of processing and printing). If that's the case, your nested loop is the wrong thing, and you can forget my caveat about nesting file reads. What you want is the zip() function for l,s in zip(f1, f2): #you now have one line from each file, # which you can then validate and process Note, this assumes that when a line is bad from either file, you're going to also ignore the corresponding line from the other. If you have to accommodate variable misses in the lining up, then your work is *much* harder. Actually these are Arff files used in Weka (Data Mining ), So they have a certain amount of header information which is the same in both files(in same no. of lines too ) and both files have equal lines, So when I read basically In both files I am trying to ignore the Header information. then it is like reading first line from f1 and first line from f2, extracting the data I want from each file and simply write it to a third file line by line... What does actually Zip function do ? Thanks and Regards That's zip not Zip Have you tried looking at the docs? Or even typing help(zip) at the python interpreter prompt? In rough terms, zip takes one element (line) from each of the iterators, and creates a new list that holds tuples of those elements. If you use it in this form: for item1, item2 in zip(iter1, iter2): then item1 will be the first item of iter1, and item2 will be the first item of iter2. You then process them, and loop around. It stops when either iterator runs out of items. https://duckduckgo.com/?q=python+zip gives me http://docs.python.org/2/library/functions.html#zip as the first link. This will read the entire content of both files into the list, so if they are more than 100meg or so, you might want to use izip(). (In Python3.x, zip will do what izip does on Python 2.x) -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading data from 2 different files and writing to a single file
That's zip not Zip Have you tried looking at the docs? Or even typing help(zip) at the python interpreter prompt? In rough terms, zip takes one element (line) from each of the iterators, and creates a new list that holds tuples of those elements. If you use it in this form: for item1, item2 in zip(iter1, iter2): then item1 will be the first item of iter1, and item2 will be the first item of iter2. You then process them, and loop around. It stops when either iterator runs out of items. https://duckduckgo.com/?q=**python+ziphttps://duckduckgo.com/?q=python+zip gives me http://docs.python.org/2/**library/functions.html#ziphttp://docs.python.org/2/library/functions.html#zip as the first link. This will read the entire content of both files into the list, so if they are more than 100meg or so, you might want to use izip(). (In Python3.x, zip will do what izip does on Python 2.x) -- DaveA -- http://mail.python.org/**mailman/listinfo/python-listhttp://mail.python.org/mailman/listinfo/python-list Thanks Dave, I am Sorry , true I dint look up for it because as per the Suggetion by Chris, 'break' does solve my problem but I wanted to know a little about 'zip' for I encounter any other problem, parsing these two files. -- http://mail.python.org/mailman/listinfo/python-list
I have issues installing pycrypto (and thus fabric) with pip
I'm not sure this is the right place for this but I'm don't know where else to put this. I want to give fabric a try (as recommended here: http://www.jeffknupp.com/blog/2012/10/24/starting-a-django-14-project-the-right-way/). Installing fabric results in two dependencies (paramiko and pycrypto) being installed as well. All is dandy until it is time to install pycrypto. A bit of searching reveals this in the documentation: Package tools We strongly recommend using pip to install Fabric as it is newer and generally better than easy_install. However, a combination of bugs in specific versions of Python, pip and PyCrypto can prevent installation of PyCrypto. Specifically: Python = 2.5.x PyCrypto = 2.1 (which is required to run Fabric = 1.3) pip 0.8.1 When all three criteria are met, you may encounter No such file or directory IOErrors when trying to pip install Fabric or pip install PyCrypto. The fix is simply to make sure at least one of the above criteria is not met, by doing the following (in order of preference): Upgrade to pip 0.8.1 or above, e.g. by running pip install -U pip. Upgrade to Python 2.6 or above. Downgrade to Fabric 1.2.x, which does not require PyCrypto = 2.1, and install PyCrypto 2.0.1 (the oldest version on PyPI which works with Fabric 1.2.) (dp130128)cheeky@n5110:~/proj/dp130128$ yolk -l Django - 1.4.3- active Python - 2.7.3- active development (/usr/lib/python2.7/lib-dynload) --check South - 0.7.6- active argparse- 1.2.1- active development (/usr/lib/python2.7) pip - 1.2.1- active --check setuptools - 0.6c11 - active wsgiref - 0.1.2- active development (/usr/lib/python2.7) yolk- 0.4.3- active I've got pip and python covered above but I'm still unable to install fabric as shown below. (dp130128)cheeky@n5110:~/proj/dp130128$ pip install fabric Downloading/unpacking fabric Running setup.py egg_info for package fabric warning: no previously-included files matching '*' found under directory 'docs/_build' warning: no previously-included files matching '*.pyc' found under directory 'tests' warning: no previously-included files matching '*.pyo' found under directory 'tests' Downloading/unpacking paramiko=1.9.0 (from fabric) Running setup.py egg_info for package paramiko Downloading/unpacking pycrypto=2.1,!=2.4 (from paramiko=1.9.0-fabric) Running setup.py egg_info for package pycrypto Installing collected packages: fabric, paramiko, pycrypto Running setup.py install for fabric warning: no previously-included files matching '*' found under directory 'docs/_build' warning: no previously-included files matching '*.pyc' found under directory 'tests' warning: no previously-included files matching '*.pyo' found under directory 'tests' Installing fab script to /home/cheeky/.virtualenvs/dp130128/bin Running setup.py install for paramiko Running setup.py install for pycrypto warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath. building 'Crypto.Hash._MD2' extension gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-i686-2.7/src/MD2.o src/MD2.c:31:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 Complete output from command /home/cheeky/.virtualenvs/dp130128/bin/python -c import setuptools;__file__='/home/cheeky/.virtualenvs/dp130128/build/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec')) install --record /tmp/pip-0X00No-record/install-record.txt --single-version-externally-managed --install-headers /home/cheeky/.virtualenvs/dp130128/include/site/python2.7: running install running build running build_py running build_ext running build_configure warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath. building 'Crypto.Hash._MD2' extension gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-i686-2.7/src/MD2.o src/MD2.c:31:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 Command /home/cheeky/.virtualenvs/dp130128/bin/python -c import setuptools;__file__='/home/cheeky/.virtualenvs/dp130128/build/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec')) install --record /tmp/pip-0X00No-record/install-record.txt --single-version-externally-managed --install-headers /home/cheeky/.virtualenvs/dp130128/include/site/python2.7 failed with error
WLAN tester
I'm looking to make a WLAN tester for a manufacturing test. Something that could send and receive a bunch of files and measure how long it took. I would repeat this a number of times for a device under test and then use some metric to decide pass/fail and create a report. What libraries are available for Python for communicating with networks? My google searches have been disappointing. I'd prefer to do this in Windows but I'll consider Linux if that is the better option. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: WLAN tester
On 01/28/2013 10:47 AM, Wanderer wrote: I'm looking to make a WLAN tester for a manufacturing test. Something that could send and receive a bunch of files and measure how long it took. I would repeat this a number of times for a device under test and then use some metric to decide pass/fail and create a report. What libraries are available for Python for communicating with networks? My google searches have been disappointing. I'd prefer to do this in Windows but I'll consider Linux if that is the better option. Thanks For what version of Python? Depending on what's at the far end of your connection, you may not need to do much at all. For example, if you have an ftp server, check out http://docs.python.org/2/library/ftplib.html in the standard library. Since you're doing performance testing, be aware that it's quite tricky to get meaningful results.For example, some connections have a satellite link in them, and thus have very long latency. A simple protocol will go very slowly in such a case, but most downloaders will open multiple sockets, and do many transfers in parallel. So you could either measure the slow way or the fast way, and both numbers are meaningful. Of course, it's more than a 2-way choice. Some protocols will compress the data, send it, and decompress it on the other end. Others (like the one rsync uses) will evaluate both ends, and decide which (if any) files need to be transferred at all. I believe it also does partial file updates if possible, but I'm not at all sure about that. Naturally, the throughput will vary greatly from moment to moment, and may be affected by lots of things you cannot see. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: WLAN tester
On Monday, January 28, 2013 11:30:47 AM UTC-5, Dave Angel wrote: On 01/28/2013 10:47 AM, Wanderer wrote: I'm looking to make a WLAN tester for a manufacturing test. Something that could send and receive a bunch of files and measure how long it took. I would repeat this a number of times for a device under test and then use some metric to decide pass/fail and create a report. What libraries are available for Python for communicating with networks? My google searches have been disappointing. I'd prefer to do this in Windows but I'll consider Linux if that is the better option. Thanks For what version of Python? Depending on what's at the far end of your connection, you may not need to do much at all. For example, if you have an ftp server, check out http://docs.python.org/2/library/ftplib.html in the standard library. Since you're doing performance testing, be aware that it's quite tricky to get meaningful results.For example, some connections have a satellite link in them, and thus have very long latency. A simple protocol will go very slowly in such a case, but most downloaders will open multiple sockets, and do many transfers in parallel. So you could either measure the slow way or the fast way, and both numbers are meaningful. Of course, it's more than a 2-way choice. Some protocols will compress the data, send it, and decompress it on the other end. Others (like the one rsync uses) will evaluate both ends, and decide which (if any) files need to be transferred at all. I believe it also does partial file updates if possible, but I'm not at all sure about that. Naturally, the throughput will vary greatly from moment to moment, and may be affected by lots of things you cannot see. -- DaveA Yes. I noticed this variability. I've been using the Totusoft Lan_Speedtest.exe to test some modules. I've tested through the wifi to our intranet and saw variations I believe do to network traffic. I also tried peer to peer and the write time actual got worse. I don't know if it has do to with the firewall or the hard drive speed or just Windows giving this process low priority. I also saw drop outs. So figuring out the metric for pass/fail will be interesting. I'll check into setting an ftp for this test. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: I have issues installing pycrypto (and thus fabric) with pip
On Mon, Jan 28, 2013 at 4:21 PM, Nicholas Kolatsis nkolat...@gmail.com wrote: I'm not sure this is the right place for this It is but I'm don't know where else to put this. Here. (s/I’m/I/) I want to give fabric a try (as recommended here: http://www.jeffknupp.com/blog/2012/10/24/starting-a-django-14-project-the-right-way/). Installing fabric results in two dependencies (paramiko and pycrypto) being installed as well. All is dandy until it is time to install pycrypto. Note that Fabric is useful for much, MUCH more than this. (dp130128)cheeky@n5110:~/proj/dp130128$ pip install fabric Off-topic: why is your virtualenv/project name so weird? Downloading/unpacking fabric Running setup.py egg_info for package fabric warning: no previously-included files matching '*' found under directory 'docs/_build' warning: no previously-included files matching '*.pyc' found under directory 'tests' warning: no previously-included files matching '*.pyo' found under directory 'tests' Downloading/unpacking paramiko=1.9.0 (from fabric) Running setup.py egg_info for package paramiko Downloading/unpacking pycrypto=2.1,!=2.4 (from paramiko=1.9.0-fabric) Running setup.py egg_info for package pycrypto Installing collected packages: fabric, paramiko, pycrypto Running setup.py install for fabric warning: no previously-included files matching '*' found under directory 'docs/_build' warning: no previously-included files matching '*.pyc' found under directory 'tests' warning: no previously-included files matching '*.pyo' found under directory 'tests' Installing fab script to /home/cheeky/.virtualenvs/dp130128/bin Running setup.py install for paramiko Seems to be properly installed. Running setup.py install for pycrypto warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath. building 'Crypto.Hash._MD2' extension gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-i686-2.7/src/MD2.o src/MD2.c:31:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 Here comes your problem: you do not have the Python header files, required to compile the C code used by pycrypto (for speed in certain operations, because they are quite resource-intensive). Where can you get them? I don’t know, ask your distro. They are usually in a package ending with -dev or -devel (depending on your distro; human distros do not bother with this and ship them along with the rest of the thing…) -- Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16 stop html mail| always bottom-post http://asciiribbon.org| http://caliburn.nl/topposting.html -- http://mail.python.org/mailman/listinfo/python-list
Arpex Capital Seleciona: Programador Python Pleno/RJ
Arpex Capital seleciona para uma de suas startups: Programador Python Pleno Descrição: Programador para Web Crawler Python - Experiência mínima de 1 ano em python - Conhecimento de padrões de projeto - Sólido conhecimento OO - Ser auto-gerenciável - Conhecimento de SQL Desejável: - Ter github - Ter interesse por NPL Já ter feito um scraper/crawler/parser - Saber qualquer NoSQL Local de Trabalho: Botafogo/RJ Graduação Completa em Ciência da Computação e/ou afins; Os interessados deverão enviar CV com PRENTENSÃO SALARIAL para kgar...@arpexcapital.com.br , mencionando no assunto Programador Python/Botafogo. -- http://mail.python.org/mailman/listinfo/python-list
Re: WLAN tester
On 28 January 2013 17:07, Wanderer wande...@dialup4less.com wrote: Yes. I noticed this variability. I've been using the Totusoft Lan_Speedtest.exe to test some modules. I've tested through the wifi to our intranet and saw variations I believe do to network traffic. I also tried peer to peer and the write time actual got worse. I don't know if it has do to with the firewall or the hard drive speed or just Windows giving this process low priority. I also saw drop outs. So figuring out the metric for pass/fail will be interesting. I'll check into setting an ftp for this test. Why involve a protocol at all? I'd just create a socket (http://docs.python.org/3.3/library/socket.html) and measure how long, on average, it took to write a given number of arbitrary bytes (e.g. This is a string repeated a million times) to it and then read a given number of bytes back. That would be a relatively consistent metric, whereas if you try using FTP you'll run into issues, as already noted, where disk read/write speed and details of your FTP server implementation like compression or multiple network connections affect the result significantly. -- Robert K. Day robert@merton.oxon.org -- http://mail.python.org/mailman/listinfo/python-list
The London Python Group:Switch to Python 3… Now… Immediately - February 12th
Russel Winder gives numerous reasons why now is the time for you to switch to Python 3 RIGHT NOW! With Python 3.2 and even more with Python 3.3, Python 3 became usable for release products. Indeed given the things that are in Python 3 that are not being back-ported to Python 2, using Python 3 should probably be considered mandatory for all Python use. Certainly for new projects, and 2 → 3 ports for all extant codes. In this session we will investigate some of the issues, especially those relating to handling of concurrency and parallelism, and in particular concurrent.futures. Some material on CSP will almost certainly creep into the session. Sign up for the free evening event here - http://skillsmatter.com/podcast/java-jee/switch-to-python-3-now-immediately -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading data from 2 different files and writing to a single file
On 28-Jan-2013 15:49, Chris Angelico wrote: On Tue, Jan 29, 2013 at 1:37 AM, Dave Angel d...@davea.name wrote: What you want is the zip() function for l,s in zip(f1, f2): #you now have one line from each file, # which you can then validate and process Note, this assumes that when a line is bad from either file, you're going to also ignore the corresponding line from the other. If you have to accommodate variable misses in the lining up, then your work is *much* harder. Much harder? Not really - see my solution above with a simple 'break'. Much less clear what's going on, though, it is. Iterating together over both files with zip is much cleaner. ChrisA Nice example of the power of zip, Chris :-) -- http://mail.python.org/mailman/listinfo/python-list
pip and distutils
I have created a source distribution using distutils which specifies external packages using: setup( ..., requires = ['Foo (= 0.7)', 'Bar (= 2.4.5)'], ... ) When I use pip to install this distribution, I find that it does not automatically install the packages Foo and Bar. What extra step do I need to perform to have pip automatically install the required packages? I am using Python 3.2.3. --Vraj -- http://mail.python.org/mailman/listinfo/python-list
Re: looking for advice python
On Sunday, January 27, 2013 1:57:47 PM UTC-5, twizti...@gmail.com wrote: I am in a class and was just looking for different advice. This is the first time iv ever tried to do this. That's all that iv taken from two chapters and wondering how bad I did. I also like to learn. Thanks for everyones input This is what I have now thanks for the advice. It did seem a lot easier this way, but any criticism would be nice thanks. windows 7 and python 3.3.0 while True: try: miles = float(input(How many miles did you drive?)) break except ValueError: print(That is not a valid number. Please try again.) while True: try: gas = float(input(How many gallons of gas did you use?)) break except ValueError: print(That is not a valid number. Please try again.) mpg = miles/gas print('Your miles per gallons is', format(mpg,'.2f')) -- http://mail.python.org/mailman/listinfo/python-list
Re: WLAN tester
On Monday, January 28, 2013 12:32:50 PM UTC-5, Rob Day wrote: On 28 January 2013 17:07, Wanderer wrote: Yes. I noticed this variability. I've been using the Totusoft Lan_Speedtest.exe to test some modules. I've tested through the wifi to our intranet and saw variations I believe do to network traffic. I also tried peer to peer and the write time actual got worse. I don't know if it has do to with the firewall or the hard drive speed or just Windows giving this process low priority. I also saw drop outs. So figuring out the metric for pass/fail will be interesting. I'll check into setting an ftp for this test. Why involve a protocol at all? I'd just create a socket (http://docs.python.org/3.3/library/socket.html) and measure how long, on average, it took to write a given number of arbitrary bytes (e.g. This is a string repeated a million times) to it and then read a given number of bytes back. That would be a relatively consistent metric, whereas if you try using FTP you'll run into issues, as already noted, where disk read/write speed and details of your FTP server implementation like compression or multiple network connections affect the result significantly. -- Robert K. Day Thanks, I'll check out sockets. That's probably what I needed to search for instead WLAN and Wi-Fi. -- http://mail.python.org/mailman/listinfo/python-list
Further evidence that Python may be the best language forever
My company recently hosted a programming competition for schools across the country. One team made it to the finals using the Python client, one of the four default clients provided (I wrote it). Most of the other teams were using Java or C#. Guess which team won? http://www.windward.net/codewar/2013_01/finals.html -- http://mail.python.org/mailman/listinfo/python-list
Re: python: HTTP connections through a proxy server requiring authentication
The shipped python library code does not work. See http://bugs.python.org/issue7291 for patches. Barry -- http://mail.python.org/mailman/listinfo/python-list
Re: Further evidence that Python may be the best language forever
On 01/28/2013 03:46 PM, Malcolm McCrimmon wrote: My company recently hosted a programming competition for schools across the country. One team made it to the finals using the Python client, one of the four default clients provided (I wrote it). Most of the other teams were using Java or C#. Guess which team won? http://www.windward.net/codewar/2013_01/finals.html What language was the web page hosted in? It comes up completely blank for me. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python GUI able to display a spatial image
On Friday, January 25, 2013 8:34:16 AM UTC-8, Alex wrote: Hello, does python have capabilities to display a spatial image and read the coordinates from it? If so, what modules or extension do I need to achieve that? I'll appreciate any help. Thanks, Alex Try basemap: http://matplotlib.org/basemap/ -- http://mail.python.org/mailman/listinfo/python-list
what is the difference between commenting and uncommenting the __init__ method in this class?
what is the difference between commenting and uncommenting the __init__ method in this class? class CounterList(list): counter = 0 ##def __init__(self, *args): ##super(CounterList, self).__init__(*args) def __getitem__(self, index): self.__class__.counter += 1 return super(CounterList, self).__getitem__(index) -- http://mail.python.org/mailman/listinfo/python-list
Re: what is the difference between commenting and uncommenting the __init__ method in this class?
On 01/28/2013 09:09 PM, iMath wrote: what is the difference between commenting and uncommenting the __init__ method in this class? class CounterList(list): counter = 0 ##def __init__(self, *args): ##super(CounterList, self).__init__(*args) def __getitem__(self, index): self.__class__.counter += 1 return super(CounterList, self).__getitem__(index) If you don't call the super-class' __init__() method, then the list won't take anyparameters. So the list will be empty, -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: what is the difference between commenting and uncommenting the __init__ method in this class?
On 01/28/2013 09:09 PM, iMath wrote: what is the difference between commenting and uncommenting the __init__ method in this class? class CounterList(list): counter = 0 ## def __init__(self, *args): ## super(CounterList, self).__init__(*args) def __getitem__(self, index): self.__class__.counter += 1 return super(CounterList, self).__getitem__(index) No difference as this code doesn't do anything else in the __init__() it overrides. Normally you would add some additional processing there but if you don't need to, there is no reason to override __init__(), therefore it's clearer and better to delete those 2 lines. -m -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ It is always pleasant to be urged to do something on the ground that one can do it well. George Santayana -- http://mail.python.org/mailman/listinfo/python-list
Re: python: HTTP connections through a proxy server requiring authentication
Hi , Thanks barry, I solved that issue. I reconfigured squid3 with ncsa_auth, now its working same python code. Earlier I used digest_pw_auth. Actually I am trying to fix an issue related to python boto API. Please check this post https://groups.google.com/forum/#!topic/boto-users/1qk6d7v2HpQ Regards Saju Madhavan +91 09535134654 On Tue, Jan 29, 2013 at 5:01 AM, Barry Scott ba...@barrys-emacs.org wrote: The shipped python library code does not work. See http://bugs.python.org/issue7291 for patches. Barry -- http://mail.python.org/mailman/listinfo/python-list
Re: Further evidence that Python may be the best language forever
Michael Torrie, 29.01.2013 02:15: On 01/28/2013 03:46 PM, Malcolm McCrimmon wrote: My company recently hosted a programming competition for schools across the country. One team made it to the finals using the Python client, one of the four default clients provided (I wrote it). Most of the other teams were using Java or C#. Guess which team won? http://www.windward.net/codewar/2013_01/finals.html We did a similar (although way smaller) contest once at a university. The task was to write a network simulator. We had a C team, a Java team and a Python team, four people each. The Java and C people knew their language, the Python team just started learning it. The C team ended up getting totally lost and failed. The Java team got most things working ok and passed. The Python team got everything working, but additionally implemented a web interface for the simulator that monitored and visualised its current state. They said it helped them with debugging. What language was the web page hosted in? It comes up completely blank for me. :) Yep, same here. Hidden behind a flash wall, it seems. Stefan -- http://mail.python.org/mailman/listinfo/python-list
[issue15273] Remove unnecessarily random behavior from test_unparse.py
Daniel Cioata added the comment: a solution for this issue -- nosy: +Daniel.Cioata Added file: http://bugs.python.org/file28877/submitted_patch_Issue15273 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16997] subtests
Nick Coghlan added the comment: Right, if you want independently addressable/runnable, then you're back to parameterised tests as discussed in issue7897. What I like about Antoine's subtest idea is that I think it can be used to split the execution/reporting part of parameterised testing from the addressing/selection part. That is, while *this* patch doesn't make subtests addressable, a future enhancement or third party test runner could likely do so. (It wouldn't work with arbitrary subtests, it would only be for data driven variants like those described in issue7897) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16997 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17054] cStringIO.StringIO aborted when more then INT_MAX bytes written
Serhiy Storchaka added the comment: Indeed. -- resolution: - duplicate stage: needs patch - committed/rejected status: open - closed superseder: - cStringIO not 64-bit safe ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17054 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13555] cPickle MemoryError when loading large file (while pickle works)
Changes by Serhiy Storchaka storch...@gmail.com: -- dependencies: +cStringIO not 64-bit safe -cStringIO.StringIO aborted when more then INT_MAX bytes written ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13555 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7358] cStringIO not 64-bit safe
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka components: +Extension Modules, IO -Library (Lib) nosy: +serhiy.storchaka stage: - needs patch versions: -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7358 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17060] IDLE -- jump to home should not go past the PS1 and PS2 prompts
New submission from Raymond Hettinger: In IDLE's shell, pressing home or control-a currently jumps to the beginning of a line. Instead it should stop *after* theprompt. -- components: IDLE messages: 180841 nosy: rhettinger priority: normal severity: normal status: open title: IDLE -- jump to home should not go past the PS1 and PS2 prompts type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17060 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17059] tarfile.is_tarfile without read permissions raises AttributeError
Serhiy Storchaka added the comment: Thank you for the report, Damian. This was fixed in issue11513. -- assignee: - serhiy.storchaka components: +Library (Lib) -None nosy: +serhiy.storchaka resolution: - out of date stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17059 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13590] extension module builds fail with python.org OS X installers on OS X 10.7 and 10.6 with Xcode 4.2
Ned Deily added the comment: Attached are the back ports to 2.7.x and 3.2.x of the Xcode 4 support changes as released in 3.3.0. I've built and tested both with various configurations on a variety of systems, both Intel and PPC, and various OS X versions (10.4, 10.5, 10.6, 10.7, and 10.8), including all of the standard installer configurations. I also tested with just the standalone Command Line Tools package (for 10.7 and 10.8). With these back ports, extension module builds should once again work out of the box on all supported systems with their most recent versions of Xcode or Command Line Tools. Unless there are objections, I'll commit these in the next day or two for 2.7.4 and 3.2.4. -- stage: needs patch - commit review Added file: http://bugs.python.org/file28878/issue13590_backport_27.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13590 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13590] extension module builds fail with python.org OS X installers on OS X 10.7 and 10.6 with Xcode 4.2
Changes by Ned Deily n...@acm.org: Added file: http://bugs.python.org/file28879/issue13590_backport_32.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13590 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12691] tokenize.untokenize is broken
Thomas Kluyver added the comment: Is there anything I can do to push this forwards? I'm trying to use tokenize and untokenize in IPython, and for now I'm going to have to maintain our own copies of it (for Python 2 and 3), because I keep running into problems with the standard library module. -- nosy: +takluyver ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12691 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7358] cStringIO not 64-bit safe
Serhiy Storchaka added the comment: Here is a patch. -- keywords: +patch stage: needs patch - patch review Added file: http://bugs.python.org/file28880/cStringIO64.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7358 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17061] tokenize unconditionally emits NL after comment lines blank lines
New submission from Thomas Kluyver: The docs describe the NL token as Token value used to indicate a non-terminating newline. The NEWLINE token indicates the end of a logical line of Python code; NL tokens are generated when a logical line of code is continued over multiple physical lines. However, after a comment or a blank line, tokenize emits NL, even when it's not inside a multi-line statement. For example: In [15]: for tok in tokenize.generate_tokens(StringIO('#comment\n').readline): print(tok) TokenInfo(type=54 (COMMENT), string='#comment', start=(1, 0), end=(1, 8), line='#comment\n') TokenInfo(type=55 (NL), string='\n', start=(1, 8), end=(1, 9), line='#comment\n') TokenInfo(type=0 (ENDMARKER), string='', start=(2, 0), end=(2, 0), line='') This makes it difficult to use tokenize to detect multi-line statements, as we want to do in IPython. In my tests so far, changing two instances of NL to NEWLINE in this block (lines 530 533) makes it behave as I expect: http://hg.python.org/cpython/file/a375c3d88c7e/Lib/tokenize.py#l524 -- messages: 180846 nosy: takluyver priority: normal severity: normal status: open title: tokenize unconditionally emits NL after comment lines blank lines versions: Python 2.6, Python 2.7, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17061 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17062] An os.walk inspired replacement for pkgutil.walk_packages
New submission from Nick Coghlan: I recently had occasion to use pkgutil.walk_packages, and my immediate thought was that it would have been a lot easier for me to use if it worked more like os.walk with topdown=True, producing tuples of (pkg, subpackages, modules) pkg would be the package object at the current level (None for the top level) packages would be a dictionary mapping fully qualified module names to loader objects for the subpackages (i.e. subdirectories) modules would be a dictionary mapping fully qualified module names to loader objects for every submodule that wasn't a subpackage As with editing the subdirs list with os.walk, editing the packages dictionary with this new API would keep the iterator from loading that subpackage and avoid recursing into it (this is the part I wanted in my current use case). (This may even be PEP material, guiding some additions to the importer/finder API) -- components: Library (Lib) messages: 180847 nosy: ncoghlan priority: normal severity: normal status: open title: An os.walk inspired replacement for pkgutil.walk_packages versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17062 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17062] An os.walk inspired replacement for pkgutil.walk_packages
Nick Coghlan added the comment: Oops, forgot the proposed call signature: def walk_path(path=None, *, pkg=None): Walk a package hierarchy, starting with the given path Iterator producing (package, subpackages, submodules) triples. The first entry is the package currently being walked, or None for the top level path. The subpackages and submodules entries are dictionaries mapping from fully qualified module names to the appropriate module loaders. Entries may be removed from the subpackages dictionary to avoid loading those packages and recursing into them. If both pkg and path are None, walks sys.path If path is not None, walks the specified path. If pkg is not None, walks pkg.__path__ Providing both path and pkg results in ValueError -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17062 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17062] An os.walk inspired replacement for pkgutil.walk_packages
Nick Coghlan added the comment: Regarding the PEP comment - the piece that would be missing is the iter_modules functionality. Currently pkgutil provides the support for standard filesystem imports and zipimports directly - the generic function based extension mechanism is undocumented. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17062 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14302] Rename Scripts directory to bin and move python.exe to bin
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14302 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17052] unittest discovery should use self.testLoader
Michael Foord added the comment: I think you're correct - although I wonder if *anyone*, *ever* will be helped by the change. :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17052 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12520] spurious output in test_warnings
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12520 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17062] An os.walk inspired replacement for pkgutil.walk_packages
Changes by Serhiy Storchaka storch...@gmail.com: -- type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17062 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17052] unittest discovery should use self.testLoader
Chris Jerdonek added the comment: I will at least! :) I noticed the issue after trying to use unittest test discovery with a custom loader. Fortunately, there is at least this work-around (though it relies on an implementation detail): class MyTestProgram(unittest.TestProgram): # Override because of issue #17052. def _do_discovery(self, argv, Loader=None): if Loader is None: Loader = lambda: self.testLoader super(TestPizza, self)._do_discovery(argv, Loader=Loader) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17052 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5289] ctypes.util.find_library does not work under Solaris
Changes by Trent Nelson tr...@snakebite.org: -- nosy: +trent ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5289 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15933] flaky test in test_datetime
Changes by Ezio Melotti ezio.melo...@gmail.com: -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15933 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17063] assert_called_with could be more powerful if it allowed placeholders
New submission from Antoine Pitrou: assert_called_with currently compares every argument for equality, which is not very practical when one of the arguments is a complex object, of which you only want to check certain properties. It could be very nice if you could write e.g.: from mock import Mock, PLACEHOLDER ... my_mock(1, someobj(), bar=someotherobj()): foo, bar = my_mock.assert_called_with( 1, PLACEHOLDER, bar=PLACEHOLDER) self.assertIsInstance(bar, someobj) self.assertIsInstance(foo, someotherobj) (another name for PLACEHOLDER could be CAPTURE, regex-style :-)) -- messages: 180852 nosy: michael.foord, pitrou priority: normal severity: normal status: open title: assert_called_with could be more powerful if it allowed placeholders type: enhancement versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17063] assert_called_with could be more powerful if it allowed placeholders
Michael Foord added the comment: You mean like mock.ANY ? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17063] assert_called_with could be more powerful if it allowed placeholders
Michael Foord added the comment: Oh, you want the assert_called_with call to *return* the objects compared with the placeholder? Well, mock.ANY already exists and you can pull the arguments out for individual assertions using some_mock.call_args. args, kwargs = some_mock.call_args -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16335] Integer overflow in unicode-escape decoder
Changes by Serhiy Storchaka storch...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16335 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17063] assert_called_with could be more powerful if it allowed placeholders
Antoine Pitrou added the comment: I'm noticing that with multiple ANY keyword arguments, the order in the result tuple is undefined. So perhaps ANY could be instantiable in those cases where disambiguation is required: foo, bar = my_mock.assert_called_with(1, foo=ANY(0), bar=ANY(1)) self.assertIsInstance(bar, someobj) self.assertIsInstance(foo, someotherobj) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17063] assert_called_with could be more powerful if it allowed placeholders
Antoine Pitrou added the comment: Ah, well... I agree mock.ANY sounds cool :-) Perhaps it could be mentioned in the docs for assert_etc.? Otherwise you only learn about it if you are masochistic enough to read the doc till the end :-) you can pull the arguments out for individual assertions using some_mock.call_args. Yeah, but it's cumbersome and it boils down to doing the matching by hand, while assert_called_something already does it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16979] Broken error handling in codecs.unicode_escape_decode()
Serhiy Storchaka added the comment: Ezio, is it a good factorization? def check(self, coder): def checker(input, expect): self.assertEqual(coder(input), (expect, len(input))) return checker def test_escape_decode(self): decode = codecs.unicode_escape_decode check = self.check(decode) check(b[\\\n], []) check(br'[\]', '[]') check(br[\'], [']) # other 20 checks ... And same for test_escape_encode and for bytes escape decoder. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16979 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler
Benjamin Peterson added the comment: Does this still need to block 2.7.4? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13994 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17037] Use a test.support helper to wrap the PEP 399 boilerplate
Brett Cannon added the comment: True, the current idiom needs to still be used in those cases, although we could introduce another method to help with this situation as well: # Could also be named use_accelerator to be less hostile-sounding. def requires_accelerator(self, cls): if self.accelerated_module is None: raise SkipTest # With proper message else: setattr(cls, self.module_name, self.accelerated_module) return cls Then the idiom becomes: @pep399_tests.requires_accelerator class AcceleratorSpecificTests(unittest.TestCase): pass This then extends out to also the current idiom if you don't want to have any magical classes: @pep399_tests.requires_accelerator class AcceleratedExampleTests(unittest.TestCase): pass # Can add another decorator for this if desired. class PyExampleTests(unittest.TestCase): module = pep399_tests.py_module This also has the benefit of extracting out the module attribute name to minimize messing even that up. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17037 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16968] Fix test discovery for test_concurrent_futures.py
Zachary Ware added the comment: Thank you, Chris. I'm rather ashamed of how long I've spent beating my head on this issue and missed the spare tests reference in runtest_inner. Simply removing the tests name entirely clears things up, if this isn't too ugly: diff -r 5f655369ef06 Lib/test/regrtest.py --- a/Lib/test/regrtest.py Mon Jan 28 13:27:02 2013 +0200 +++ b/Lib/test/regrtest.py Mon Jan 28 08:50:59 2013 -0600 @@ -1275,8 +1275,8 @@ # tests. If not, use normal unittest test loading. test_runner = getattr(the_module, test_main, None) if test_runner is None: -tests = unittest.TestLoader().loadTestsFromModule(the_module) -test_runner = lambda: support.run_unittest(tests) +test_runner = lambda: support.run_unittest( +unittest.TestLoader().loadTestsFromModule(the_module)) test_runner() if huntrleaks: refleak = dash_R(the_module, test, test_runner, As far as the reap_threads wrapper and reap_children follow-up, I think the TestSuite subclass and load_tests function in the last patch I uploaded may be about the simplest way to keep them for this test without adding them to all tests (by adding it to regrtest.runtest_inner). If anyone thinks the 'ReapedSuite' class (or a better named copy) could be useful elsewhere, it might could go in test.support which would make test_concurrent_futures look a little cleaner. Patch v3 is v2 plus the regrtest change inline above. -- Added file: http://bugs.python.org/file28881/test_concurrent_futures_discovery.v3.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16968 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler
Éric Araujo added the comment: 2.7.3 broke some setup scripts, it wouldn’t be bad to fix this in 2.7.4. I’ll make time before RC. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13994 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13539] Return value missing in calendar.TimeEncoding.__enter__
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - duplicate stage: test needed - committed/rejected status: open - closed superseder: - calendar throws UnicodeEncodeError when locale is specified ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13539 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17049] calendar throws UnicodeEncodeError when locale is specified
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +JJeffries, Retro, christian.heimes, eric.araujo, georg.brandl, haypo, ixokai, psam, r.david.murray, tim.golden, twouters ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17049 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17064] Fix sporadic buildbot failures for test_mailbox
New submission from Jeremy Kloth: Attached is an attempt at fixing the sporadic failures of test_mailbox on the AMD64 Windows buildbot. It fails due to access errors on some directories which leads me to believe the helper functions in test.support should fix the problem. -- components: Tests files: test_mailbox.diff keywords: patch messages: 180862 nosy: jkloth priority: normal severity: normal status: open title: Fix sporadic buildbot failures for test_mailbox versions: Python 3.3, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file28882/test_mailbox.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17064 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17065] Fix sporadic buildbot failures for test_winreg
New submission from Jeremy Kloth: test_winreg fails sporadically on the AMD64 Windows buildbot. Looking at the test, it appears that concurrent runs of the test would fail if different processes attempted to modify the test key at the same time. The attached patch resolves this by using a per-process unique test key name using the process ID. -- components: Tests files: test_winreg.diff keywords: patch messages: 180863 nosy: jkloth priority: normal severity: normal status: open title: Fix sporadic buildbot failures for test_winreg versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file28883/test_winreg.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17065 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17064] Fix sporadic buildbot failures for test_mailbox
R. David Murray added the comment: I think the support functions just ignore errors. Isn't this going to continue to leave garbage on the buildbot filesystem without fixing the underlying problem? I wonder if this is a variation on the usual Windows access errors, in which case perhaps that is the best we can do... -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17064 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17049] calendar throws UnicodeEncodeError when locale is specified
Georg Brandl added the comment: Serhiy: not sure why all those people belong in the nosy list. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17049 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17049] calendar throws UnicodeEncodeError when locale is specified
Serhiy Storchaka added the comment: They moved from issue13539 which I have closed as a duplicate. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17049 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17063] assert_called_with could be more powerful if it allowed placeholders
Michael Foord added the comment: Yes there are definitely room for documentation improvements. And, yes - pulling the args out from some_mock.call_args boils down to doing the matching by hand. You only do it when you *want* to do the matching by hand. Your use case I would write: from mock import Mock, ANY ... my_mock(1, someobj(), bar=someotherobj()) my_mock.assert_called_with(1, ANY, bar=ANY) args, kwargs = my_mock.call_args foo = args[1] bar = kwargs['bar'] self.assertIsInstance(bar, someobj) self.assertIsInstance(foo, someotherobj) It's a *little* cumbersome, but not something I do very often and not much extra code. I'm not sure that having assert_called_with return objects is an intuitive API either. (And having to specify tuple indices in a call to ANY is a bit odd too.) Custom matchers that do the comparison in their __eq__ method would be another possibility: class IsInstance(object): def __init__(self, Type): self.Type = Type def __eq__(self, other): return isinstance(other, self.Type) my_mock.assert_called_with(1, IsInstance(someobj), bar=IsInstance(someotherobj)) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17064] Fix sporadic buildbot failures for test_mailbox
Jeremy Kloth added the comment: Actually, the support functions (as of 3.3) attempt to work around the access errors. They attempt to wait (to a point) for a successful operation before returning to the caller. See issue15496 for details. It is usually the case that the previous operation has not yet finished as to the cause of the access error. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17064 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17051] Memory leak in os.path.isdir under Windows
Roundup Robot added the comment: New changeset 4deb294ff567 by Serhiy Storchaka in branch '2.7': Issue #17051: Fix a memory leak in os.path.isdir() on Windows. Patch by Robert Xiao. http://hg.python.org/cpython/rev/4deb294ff567 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17051 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17051] Memory leak in os.path.isdir under Windows
Serhiy Storchaka added the comment: Committed. Thank you for patch. -- resolution: - fixed stage: commit review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17051 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16624] subprocess.check_output should allow specifying stdin as a string
Zack Weinberg added the comment: Contributor agreement resent by email. Sorry for the delay. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17051] Memory leak in os.path.isdir under Windows
Roundup Robot added the comment: New changeset 51173aba06eb by Serhiy Storchaka in branch '2.7': Add Robert Xiao to Misc/ACKS for issue17051. http://hg.python.org/cpython/rev/51173aba06eb -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17051 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4590] 2to3 strips trailing L for long iterals in two fixers
Fábio M. Costa added the comment: I believe that since this change the 2to3 documentation is outdated. http://docs.python.org/2/library/2to3.html#2to3fixer-long http://docs.python.org/2/library/2to3.html#2to3fixer-numliterals http://docs.python.org/3/library/2to3.html#2to3fixer-long http://docs.python.org/3/library/2to3.html#2to3fixer-numliterals They could be updated to something like this: long Renames long to int. Check `numliterals` if you want to strip the L suffix on long literals. numliterals Converts octal and long literals into the new syntax. Sorry if this is not the right channel to send documentation bug reports. -- nosy: +fabiomcosta versions: +Python 2.7 -3rd party ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4590 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17065] Fix sporadic buildbot failures for test_winreg
Changes by Serhiy Storchaka storch...@gmail.com: -- components: +Windows nosy: +brian.curtin, stutzbach stage: - patch review type: - behavior versions: -Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17065 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com