Re: OT: Entitlements [was Re: Python usage numbers]
On Feb 18, 12:34 pm, Rick Johnson wrote: > Louie-the-loose-screw Said: "I'll give you $15 if you'll give me $15!" $15 dolla too beau coup! 5 dolla each! -- http://mail.python.org/mailman/listinfo/python-list
Help with python-list archives
Hi. I am new to python and wanted to search the python-list archives for answers to my many questions but i can't seem to get the archive files to uncompressed? What gives? From what i understand they are gzip files so i assumed the gzip module would work, but no! The best i could do was to get a ton of chinese chars using gzip and zlib.uncompress(). I would like to be courteous and search for my answers before asking so as not to waste anyones time. Does anyone know how to uncompress these files into a readable text form? -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with python-list archives
On Jan 5, 5:39 pm, Miki Tebeka wrote: > Is the Google groups search not good enough? That works but i would like to do some regexes and set up some defaults. > Also, can you give an example of the code and an input file? Sure. Take the most recent file as example. "2012 - January.txt.gz". If you use the python doc example this is the result. If i use "r" or "rb" the result is the same. >>> import gzip >>> f1 = gzip.open('C:\\2012-January.txt.gz', 'rb') >>> data = f1.read() >>> data[:100] '\x1f\x8b\x08\x08x\n\x05O\x02\xff/srv/mailman/archives/private/python- list/2012-January.txt\x00\xec\xbdy\x7f\xdb\xc6\xb50\xfcw\xf0)\xa6z|+ \xaa!!l\xdc\x14[\x8b-;V\xe2-\x92\x12' >>> f2 = gzip.open('C:\\2012-January.txt.gz', 'r') >>> data = f2.read() >>> data[:100] '\x1f\x8b\x08\x08x\n\x05O\x02\xff/srv/mailman/archives/private/python- list/2012-January.txt\x00\xec\xbdy\x7f\xdb\xc6\xb50\xfcw\xf0)\xa6z|+ \xaa!!l\xdc\x14[\x8b-;V\xe2-\x92\x12' The docs and google provide no clear answer. I even tried 7zip and ended up with nothing but gibberish characters. There must be levels of compression or something. Why could they not simply use the tar format? Is there anywhere else one can download the archives? -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with python-list archives
On Jan 5, 6:10 pm, Ian Kelly wrote: > Interesting. I tried this on a Linux system using both gunzip and > your code, and both worked fine to extract that file. I also tried > your code on a Windows system, and I get the same result that you do. > This appears to be a bug in the gzip module under Windows. > > I think there may be something peculiar about the archive files that > the module is not handling correctly. If I gunzip the file locally > and then gzip it again before trying to open it in Python, then > everything seems to be fine. That is interesting. I wonder if anyone else has had the same issue? Just to be thorough I tried to uncompress using both python 2.x and 3.x and the results are unreadable text files in both cases. I have no idea what the problem could be. Especially without some way to compare my files to the gunzip'ed files on a linux machine. -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with python-list archives
On Jan 5, 7:27 pm, MRAB wrote: > I've found that if I gunzip it twice (gunzip it and then gunzip the > result) using the gzip module I get the text file. On a windows machine? If so, can you post a code snippet please? Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with python-list archives
On Jan 5, 9:00 pm, MRAB wrote: > On 06/01/2012 02:14, random joe wrote: > > > On Jan 5, 7:27 pm, MRAB wrote: > > >> I've found that if I gunzip it twice (gunzip it and then gunzip the > >> result) using the gzip module I get the text file. > > > On a windows machine? If so, can you post a code snippet please? > > Thanks > > import gzip > > in_file = gzip.open(r"C:\2012-January.txt.gz") > out_file = open(r"C:\2012-January.txt.tmp", "wb") > out_file.write(in_file.read()) > in_file.close() > out_file.close() > > in_file = gzip.open(r"C:\2012-January.txt.tmp") > out_file = open(r"C:\2012-January.txt", "wb") > out_file.write(in_file.read()) > in_file.close() > out_file.close() EXCELLENT! Thanks. THis works however there is one more tiny hiccup. The text has lost all significant indention and newlines. Was this intended or is this a result of another bug? -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with python-list archives
On Jan 5, 10:01 pm, random joe wrote: > On Jan 5, 9:00 pm, MRAB wrote: > > import gzip > > > in_file = gzip.open(r"C:\2012-January.txt.gz") > > out_file = open(r"C:\2012-January.txt.tmp", "wb") > > out_file.write(in_file.read()) > > in_file.close() > > out_file.close() > > > in_file = gzip.open(r"C:\2012-January.txt.tmp") > > out_file = open(r"C:\2012-January.txt", "wb") > > out_file.write(in_file.read()) > > in_file.close() > > out_file.close() > > EXCELLENT! Thanks. > > THis works however there is one more tiny hiccup. The text has lost > all significant indention and newlines. Was this intended or is this a > result of another bug? Nevermind. Notepad was the problem. After using a real editor the text is displayed correctly! Thanks for help everyone! PS: I wonder why no one has added a note to the Python-list archives to advise people about the bug? -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with python-list archives
On Jan 6, 1:41 am, Ian Kelly wrote: > One could also avoid creating the intermediate file by using a > StringIO to keep it in memory instead: Yes StringIO is perfect for this. Many thanks to all who replied. -- http://mail.python.org/mailman/listinfo/python-list
Tkinter Toplevel sizing issue (using a grid)
Hello all, Hi this i my first post here. I would like to create a tkinter toplevel window with a custom resize action based on a grid. From the Tk docs it say you can do this but for the life of me i cannot figure out how? In my app i wish for the main window to only resize in 20 pixel "jumps" (if you will). I have tried using the toplevel.grid() and setgrid option and no luck! ## here is the tk doc page about setGrid http://www.tcl.tk/man/tcl/TkLib/SetGrid.htm ## here is the Tkinter method from wm class def wm_grid(self, baseWidth=None, baseHeight=None, widthInc=None, heightInc=None): """Instruct the window manager that this widget shall only be resized on grid boundaries. WIDTHINC and HEIGHTINC are the width and height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are the number of grid units requested in Tk_GeometryRequest.""" return self._getints(self.tk.call( 'wm', 'grid', self._w, baseWidth, baseHeight, widthInc, heightInc)) grid = wm_grid ## Here is my code. from Tkinter import * class TopWin(Tk): def __init__(self): Tk.__init__(self)#, setgrid=1) #self.maxsize(width=50, height=50) #self.minsize(width=1, height=1) self.grid(10, 10, 20, 20) topwin = TopWin() topwin.mainloop() Please help. I am going nuts trying to make this work for three hours already :( -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter Toplevel sizing issue (using a grid)
Hi again, Is this possible to do? From lack of response i don't know if this is impossible or just nobody has done this before. If anybody know solution thank you. -- http://mail.python.org/mailman/listinfo/python-list