Re: iteration over non-sequence ,how can I resolve it?
On 28 May 2006 06:20:20 -0700, python <[EMAIL PROTECTED]> wrote: > at line "for j in linkReturned:" , raise an error: > File "C:\pythonProgram\test.py", line 308, in main > for j in linkReturned: > TypeError: iteration over non-sequence > how can I get a list from the return of thread.start() ? You can't. thread.start() always return None. > class PrintThread(threading.Thread): > def __init__(self, urlList): > threading.Thread.__init__(self) > urllist=[] > self.urllist=urlList >def run(self): > urllink=[] > .. > return urllink > > > for i in range(0,2): > thread=PrintThread(links) > threadList.append(thread) > linkReturned=[] > for i in threadList: > linkReturned=i.start() > for j in linkReturned: > links.append(j) >From the looks of this code it seems like you want a sub-routine not a thread. You can simulate returning a value from a thread by adding a "return value" attribute to the PrintThread class that the run() method writes to. Then you would have to add some form of synchronizing so that your main program does not try to read the "return value" of the thread before the thread actually has written the "return value." -- mvh Björn -- http://mail.python.org/mailman/listinfo/python-list
Re: Using a package like PyInstaller
"Im 99.999% confident that this will not happen from the .exe file generated by pyinstaller (unless you specify--see link above)." Well I guess that's about as close as any one can get in this business. I have been trying to introduce py into our environment, and have opened a few eyes, however I have been given one restriction. I can not install anything, leave behind anything or alter anything on a systems .. period, and as the saying goes "To error is human but to forgive is not company policy!" thx for your comments! "James Stroud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > LittlePython wrote: > > That is very close to what I have being doing, however I was unable to > > enclose a bmp or another file for that matter in the exe. I used both DATA > > and BINARY key words with no luck. I checked what was in the package and > > there were there. I guess for some reason it could not locate then when > > executed. I used snap 274 if I remember correctly. > > You can include files with innosetup under the [FILES] section. The docs > show how. You can then code absolute paths to these resources in your > code according to the results of 'sys.platform'. If you use the > "--onedir" option, then you may want to look here: > > http://pyinstaller.hpcf.upr.edu/docs/Manual_v1.1.html#accessing-data-files > > > > I am worrying that > > when the py script is run I am leaving behind files. That the components of > > my stand-alone exe is somehow coming out of the exe (PyInstaller) and being > > installed. > > Im 99.999% confident that this will not happen from the .exe file > generated by pyinstaller (unless you specify--see link above). > > However, innosetup will put files in the 'Program Files' directory or > wherever you specify. This would be similar to just about every other > application out there for windows. > > James > > -- > James Stroud > UCLA-DOE Institute for Genomics and Proteomics > Box 951570 > Los Angeles, CA 90095 > > http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: iteration over non-sequence ,how can I resolve it?
To BJörn Lindqvist : thank you . how to write the code specifically ?Could you give a example? -- http://mail.python.org/mailman/listinfo/python-list
Re: iteration over non-sequence ,how can I resolve it?
To BJörn Lindqvist : thank you . how to write the code specifically ?Could you give an example? -- http://mail.python.org/mailman/listinfo/python-list
Re: unexpected behaviour for python regexp: caret symbol almost useless?
"conan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This regexp > '' > > works well with 'grep' for matching lines of the kind > > > on a XML .glade file > As Peter Otten has already mentioned, this is the difference between the re "match" and "search" methods. As purely a lateral exercise, here is a pyparsing rendition of your program: from pyparsing import makeXMLTags, line # define pyparsing patterns for begin and end XML tags widgetStart,widgetEnd = makeXMLTags("widget") # read the file contents glade_file_name = 'some.glade' gladeContents = open(glade_file_name).read() # scan the input string for matching tags for widget,start,end in widgetStart.scanString(gladeContents): print "good:", line(start, gladeContents).strip() print widget["class"], widget["id"] print "Class: %(class)s; Id: %(id)s" % widget Not quite an exact match, only the good lines get listed. But also check out some of the other capabilities. To do this with re's, you have to clutter up the re expression with field names, as in: (r'".*") id="(?P.*)">') The parsing patterns generated by makeXMLTags give dict-like and attribute-like access to any attributes included with the tag. If not for the unfortunate attribute name "class" (which is a Python keyword), you could also reference these values as widget.class and widget.id. If you are parsing HTML, there is also a makeHTMLTags method, which creates patterns that are less rigid about upper/lower case and other XML strictnesses. -- Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: Array? Please help.
No it is not home work. (I have not did any home work for more than 50 years.) I am a beginner, and just do not see a really proper way to program the question. Thanks anyhow. Scott David Daniels wrote: > Dr. Pastor wrote: > >> I need a row of 127 bytes that I will use as a >> circular buffer. Into the bytes (at unspecified times) >> a mark (0> After some time the "buffer" will contain the last 127 marks. > > > Sounds a lot like homework. > -- http://mail.python.org/mailman/listinfo/python-list
Re: dynamic type changing
[EMAIL PROTECTED] a écrit : >>>I'm working on a "TempFile" class that stores the data in memory until >>>it gets larger than a specified threshold (as per PEP 42). Whilst >>>trying to implement it, I've come across some strange behaviour. Can >>>anyone explain this? > > >>>The test case at the bottom starts a TempFile at size 50 and prints its >>>type. It then increases the size to the threshold at which point >>>"self" is changed to being a TemporaryFile. > >>Changed how ?-) > > Just by being assigned with a TemporaryFile object. > > I thought that if > you do > > instance = TempFile() > > that "instance" and "self" defined in the Class They are not defined "in the class". > were the same thing so > that if you changed the class of self, > the class of instance would also > change. Yes, of course - but you didn't change the class of 'self' !-) Python's "variable" are really just names "bound to" (referring to) objects. Rebinding (ie: assignment) does not impact the object (well, not directly), it just associate the name to another object. This is totally different from changing the state of the object. There's nothing magical about the name 'self' - FWIW, you could replace it by any other valid python identifier. In Python, a method is just a plain function that takes the instance as the first argument. This function is wrapped into a method descriptor (google for python's descriptor protocol - it's the same thing that is used for properties) that takes care of feeding the function with the instance. FWIW, given: class Obj(object): def someMethod(self): pass obj = Obj() then obj.someMethod() is the same as Obj.someMethod(obj) or also: obj.someMethod.im_func(obj) So, inside someMethod's code, normal scoping rules apply. This means that 'self' is a *local* name, and rebinding it only affect the local scope. And it doesn't "change the type" of the object (previously) bound to 'self', it really re-bind 'self' to another object (IOW: makes 'self' a reference to another object). Just like it does in any other Python code. As I wrote, to dynamicall change the class of an object, you must rebind obj.__class__ to another class, ie: class Other(object): def __init__(self, name): self.name = name obj = Obj() print type(obj) obj.__class__ = Other print type(obj) Now a big warning : this is not garanteed to work seamlessly ! 'obj' will keep it's original instance attributes, and the instance attributes normally set up by the new class (here, 'Other') won't exist since the class initializer won't be called. So, while this may not be a problem if the original and new classes are designed to be used that way (which makes a very straightforward implementation of the state pattern), it's usually not a good idea to do such a thing. FWIW, it's usually simpler and safer - evn if a bit less elegant - to implement the state pattern just like I did in the example: by using composition/delegation. > Thanks very much for your example. votre humble serviteur, Messire > It has solved my problem and helped > me understand a new pattern at the same time. FWIW, there's no clear, well defined boudary between State and Strategy - the main difference depends mostly on the intention. Your use case could also be viewed as a State pattern, with 2 states : buffer < capacity, and buffer >= capacity. But the intention is not to know in which state is the object - on the contrary, you're trying to hide away the chosen implementation (StringIO or TemporayFile) - so it's really a Strategy IMHO. -- http://mail.python.org/mailman/listinfo/python-list
Beginner Python OpenGL difficulties
I'm beginning learning Python and OpenGL in Python. Python fine. But difficulties with OpenGL; presumably with the installation of OpenGL. OS = Linux FC5. Python program gl_test.py: from OpenGL.GLUT import * from OpenGL.GLU import * from OpenGL.GL import * name = "Hello, World" height = 400 etc. [EMAIL PROTECTED]/etc/python>$ python2 gl_test.py Traceback (most recent call last): File "gl_test.py", line 1, in ? from OpenGL.GLUT import * ImportError: No module named OpenGL.GLUT [EMAIL PROTECTED]/etc/python>$ echo $PYTHONPATH /usr/lib/python2.2/site-packages/OpenGL [EMAIL PROTECTED]/usr/lib/python2.2/site-packages/OpenGL>$ ll total 1076 drwxr-xr-x 13 root root 4096 May 28 15:17 Demo/ drwxr-xr-x 3 root root 4096 May 28 15:17 doc/ drwxr-xr-x 25 root root 4096 May 28 15:17 GL/ -rwxr-xr-x 1 root root 624927 Jan 2 2005 GLE.so* drwxr-xr-x 4 root root 4096 May 28 15:17 GLU/ -rwxr-xr-x 1 root root 312612 Jan 2 2005 GLUT.so* drwxr-xr-x 6 root root 4096 May 28 15:17 GLX/ -rw-r--r-- 1 root root868 Mar 12 2004 __init__.py -rw-r--r-- 1 root root 1466 Jan 2 2005 __init__.pyc etc ... Any suggestions. TIA, Jon C. -- http://mail.python.org/mailman/listinfo/python-list
propose extension of mimetypes
Hello, mimetypes lacks the guessing of .svg as image/svg+xml mimetypes.add_type("image/svg+xml",".svg", True) maybe this can be added to python 2.5 standard library Harald -- http://mail.python.org/mailman/listinfo/python-list
Finding a lost PYTHONPATH with find
OK, this is really a reminder to myself next time I forget where I set my PYTHONPATH and forget exactly how to invoke the GNU "find" command ;-) Hope somebody else finds it useful too find / -maxdepth 3 -size -100k -type f -exec grep -sli pythonpath '{}' \; The minus in '-100k' (meaning "less than 100k") seems to be undocumented, at least on my system. I suppose the -maxdepth is redundant since I think find searches breadth-first by default. The file I was looking for turned out to be in /etc/profile.d/, whose existence I completely forgot about... John -- http://mail.python.org/mailman/listinfo/python-list
Re: (mostly-)POSIX regular expressions
maybe this: http://www.pcre.org/pcre.txt and ctypes might work for you? (I was suprised to find out that PCRE supported POSIX but don't know what version it supports or how well). - Pad -- http://mail.python.org/mailman/listinfo/python-list
Re: Array? Please help.
Dr. Pastor wrote: > Scott David Daniels wrote: >> Dr. Pastor wrote: >>> I need a row of 127 bytes that I will use as a >>> circular buffer. Into the bytes (at unspecified times) >>> a mark (0>> After some time the "buffer" will contain the last 127 marks. >> Sounds a lot like homework. > No it is not home work. OK, taking you at your word, here's one way: class Circular(object): def __init__(self): self.data = array.array('b', [0] * 127) self.point = len(self.data) - 1 def mark(self, value): self.point += 1 if self.point >= len(self.data): self.point = 0 self.data[self.point] = value def recent(self): result = self.data[self.point :] + self.data[: self.point] for n, v in enumerate(result): if v: return result[n :] return result[: 0] # an empty array -- --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
itertools.count() as built-in
Is there any chance of itertools.count() ever becoming one of the built-in functions? It's a wonderful little function and I find myself importing it in every module I write. -Janto -- http://mail.python.org/mailman/listinfo/python-list
Re: (mostly-)POSIX regular expressions
Very good hint ! I wouldn't have found it alone ... I have to study the doc, but the "THE DFA MATCHING ALGORITHM" may do what I need Obviously, I didn't expect the Perl-Compatible Regular Expressions to implement "an alternative algorithm, provided by the pcre_dfa_exec() function, that operates in a different way, and is not Perl-compatible". Maybe the lib should be renamed in PCREWSO for: Perl-compatible regular expressions ... well, sort of :) Cheers, SB -- http://mail.python.org/mailman/listinfo/python-list
html 2 plain text
hi, i remember seeing this simple python function which would take raw html and output the content (body?) of the page as plain text (no <..> tags etc) i have been looking at htmllib and htmlparser but this all seems to complicated for what i'm looking for. i just need the main text in the body of some arbitrary webbpage to then do some natural-language processing with it... thanks for pointing me to some helpful resources! robin -- http://mail.python.org/mailman/listinfo/python-list
Fancy GUI with Python
Hi all. I just downloaded and installed the new Office suite from MS with their new 'ribbon' based UI. I think it's pretty cool and AFT* for a new UI paradigm. I hope it sticks. Anyway, I'm wondering how to implement a gui like this with Python. I don't think wx or qt or gtk or tkinter support this sort of fading and glowing type of effects... or do they? I played with wx way back in 2000 or so (C++ version), and it certainly didn't have any of that. I don't know if this stuff is now built into XP, or if it's specialized libraries only accessible to MS for their purposes. Can a python gui framework be redirected to use the new gui? Or is this something that has to be manually emulated from a low-level if python is to make use of it? What about under linux? So I'm not sure if this is a Python question, a xxx-Python question (where xxx is the widget toolkit of choice), or a windows API type of question. How does one make fancy fading guis with python? (cross-platform if possible) thanks ms *AFT = about freakin' time -- http://mail.python.org/mailman/listinfo/python-list
Re: Array? Please help.
Scott David Daniels wrote: > Dr. Pastor wrote: >> Scott David Daniels wrote: >>> Dr. Pastor wrote: I need a row of 127 bytes that I will use as a circular buffer. Into the bytes (at unspecified times) a mark (0>>> After some time the "buffer" will contain the last 127 marks. >>> Sounds a lot like homework. >> No it is not home work. > > OK, taking you at your word, here's one way: > (and some untested code) As penance for posting untested code, here is a real implementation: import array class Circular(object): '''A circular buffer, holds only non-zero entries''' def __init__(self, size=127): '''Create as N-long circular buffer .data is the circular data store. .point is the index of the next value to write ''' self.data = array.array('b', [0] * size) self.point = 0 def mark(self, value): '''Add a single value (non-zero) to the buffer''' assert value self.data[self.point] = value self.point += 1 if self.point >= len(self.data): self.point = 0 def recent(self): '''Return the most recent values saved.''' result = self.data[self.point :] + self.data[: self.point] for n, v in enumerate(result): if v: return result[n :] return result[: 0] # an empty array Tests: c = Circular(3) assert list(c.recent()) == [] c.mark(12) assert list(c.recent()) == [12] c.mark(11) assert list(c.recent()) == [12, 11] c.mark(10) assert list(c.recent()) == [12, 11, 10] c.mark(9) assert list(c.recent()) == [11, 10, 9] --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: send an email with picture/rich text format in the body
On Sunday 28 May 2006 07:27, anya wrote: > Acctualy there is a solution: > see http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473810 > (thanks darrin massena for sharing) > > and , if you will set all the neccessary parametrs, it won't be > recognized as a > spam, > thanks Ahah - a slightly different thing to what I thought you were after. I'd looked at "every one who open the email will see the picture" and discounted html mail. Glad you got what you wanted done, done. Ten. -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Re: html 2 plain text
robin wrote: > i remember seeing this simple python function which would take raw html > and output the content (body?) of the page as plain text (no <..> tags > etc) > i have been looking at htmllib and htmlparser but this all seems to > complicated for what i'm looking for. i just need the main text in the > body of some arbitrary webbpage to then do some natural-language > processing with it... > thanks for pointing me to some helpful resources! Have a look at the Beautiful Soup library: http://www.crummy.com/software/BeautifulSoup/ Regards -- Faber http://faberbox.com/ http://smarking.com/ A teacher must always teach to doubt his teaching. -- José Ortega y Gasset -- http://mail.python.org/mailman/listinfo/python-list
Re: Fancy GUI with Python
On Sunday 28 May 2006 19:25, [EMAIL PROTECTED] wrote: > Hi all. I just downloaded and installed the new Office suite from MS > with their new 'ribbon' based UI. I think it's pretty cool and AFT* > for a new UI paradigm. I hope it sticks. > > Anyway, I'm wondering how to implement a gui like this with Python. I > don't think wx or qt or gtk or tkinter support this sort of fading and > glowing type of effects... or do they? I played with wx way back in > 2000 or so (C++ version), and it certainly didn't have any of that. I > don't know if this stuff is now built into XP, or if it's specialized > libraries only accessible to MS for their purposes. Can a python gui > framework be redirected to use the new gui? Or is this something that > has to be manually emulated from a low-level if python is to make use > of it? What about under linux? > > So I'm not sure if this is a Python question, a xxx-Python question > (where xxx is the widget toolkit of choice), or a windows API type of > question. > > How does one make fancy fading guis with python? (cross-platform if > possible) > > thanks > ms > > *AFT = about freakin' time Unless I'm missing something (I haven't examined it exhaustively), everything therein seems quite easily doable using python and Qt. I'd check it out. Ten -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
why not in python 2.4.3
hi I made the upgrade to python 2.4.3 from 2.4.2. I want to take from google news some atom feeds with a funtion like this import urllib2 def takefeed(url): request=urllib2.Request(url) request.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT') opener = urllib2.build_opener() data=opener.open(request).read() return data url='http://news.google.it/?output=rss' d=takefeed(url) This woks well with python 2.3.5 but does not work with 2.4.3. Why? Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Serializing / Unserializing datetime
Thanks John. I've discovered that datetime.strptime will be available in 2.5, (http://docs.python.org/dev/whatsnew/modules.html) but your example will work in the meantime. BJ -- http://mail.python.org/mailman/listinfo/python-list
Re: using FFTW3 with Numeric on Windows
sven koenig wrote: > hi list, > as the subject says, I'm trying to find a way to use > FFTW3 with Numeric arrays. > I'm not very familiar with C(++) - I think ctypes is the > way to go, but I don't really have a clue how to do it. > Has somebody already tried this? scipy can use FFTW3 as its FFT routines. http://www.scipy.org -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: why not in python 2.4.3
Rocco wrote: > hi > I made the upgrade to python 2.4.3 from 2.4.2. > I want to take from google news some atom feeds with a funtion like > this > import urllib2 > def takefeed(url): > request=urllib2.Request(url) > request.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 5.5; > Windows NT') > opener = urllib2.build_opener() > data=opener.open(request).read() > return data > url='http://news.google.it/?output=rss' > d=takefeed(url) > This woks well with python 2.3.5 but does not work with 2.4.3. > Why? Define "woks [sic] well". It works fine for me on 2.4.3 (and by "works fine" I mean it ran without an exception and it returned what appeared to be RSS data). If you would give us an exception trace it would help a lot. Maybe Google's server (or your ISP's) was down. That happens sometimes. Carl -- http://mail.python.org/mailman/listinfo/python-list
Re: html 2 plain text
lucks yummy. merci beaucoup. robin -- http://mail.python.org/mailman/listinfo/python-list
q - including manpages in setup.py
Hi, What is the best way to incorporate manpages in a distutils setup.py script? Is there any distro-independent way to find the most appropriate place to put the manpages? For instance, /usr/man/? /usr/share/man? /usr/local/man? /usr/local/share/man? Also - I've got .html conversions of the manpages, for the benefit of OSs such as Windows which don't natively support manpages. What's the best place to put these? -- Cheers aum -- http://mail.python.org/mailman/listinfo/python-list
Re: Serializing / Unserializing datetime
Brendan wrote: > Thanks John. I've discovered that datetime.strptime will be available > in 2.5, (http://docs.python.org/dev/whatsnew/modules.html) but your > example will work in the meantime. > > BJ I don't think it's what you want but I had the following on file - it uses time.strptime() which I didn't know there was a problem with. Not tested beyond what you see. import time import datetime DDMMYY = ['%d %m %Y', '%d %m %y', '%d/%m/%Y', '%d/%m/%y', '%d-%m-%Y', '%d-%m-%y' ] def yearmonthday(datestring, fmts=DDMMYY): ymd = None for f in fmts: try: ymd = time.strptime( datestring, f ) break except ValueError: continue if ymd is None: raise ValueError return ymd[0], ymd[1], ymd[2] def is_valid_date(datestring, fmts=DDMMYY): try: yearmonthday(datestring, fmts) return True except ValueError: return False def string_to_date(datestring, fmts=DDMMYY): return datetime.date( *yearmonthday(datestring, fmts) ) assert string_to_date( '1/2/01', DDMMYY) == datetime.date(2001,2,1) assert string_to_date( '1 2 01', DDMMYY) == datetime.date(2001,2,1) assert string_to_date( '01/02/01', DDMMYY) == datetime.date(2001,2,1) assert string_to_date( '1/02/2001', DDMMYY) == datetime.date(2001,2,1) assert string_to_date( '29/02/2008', DDMMYY) == datetime.date(2008,2,29) assert string_to_date( '01/2/99', DDMMYY) == datetime.date(1999,2,1) for d in [ '', '32/1/01', '01/13/01', '29/2/07', '1/2', 'abcdef' ]: assert not is_valid_date(d, DDMMYY) Gerard -- http://mail.python.org/mailman/listinfo/python-list
Re: Fancy GUI with Python
> Hi all. I just downloaded and installed the new Office suite from MS > with their new 'ribbon' based UI. I think it's pretty cool and AFT* > for a new UI paradigm. I hope it sticks. > Anyway, I'm wondering how to implement a gui like this with Python. I haven't seen their new Office suit (apart form a few screenshots). Judging from the past, the code is probably statically linked to MS Office. Many of the previous iterations of MS Office did introduce their own look and feels, effects and widgets. Third party Windows developers soon followed suit reimplementing the widgets. Delphi community for example focuses a lot on UI and UI effects (Python community does not). VCL libraries can be compiled to ActiveX components and you should then be able to use them from Python, at least on Windows. Or maybe someone will make a .NET assembly and you will be able to drive it from IronPython or Python for .NET. If you are lucky, it may even be cross-platform via Mono. > So I'm not sure if this is a Python question, a xxx-Python question > (where xxx is the widget toolkit of choice), or a windows API type of > question. This is NOT a Python specific issue. It is a widget library and FFI (Foreign Function Interface) issue. If another language can get at the functionality, so can Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: html 2 plain text
> i remember seeing this simple python function which would take raw html > and output the content (body?) of the page as plain text (no <..> tags > etc) http://www.aaronsw.com/2002/html2text/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Array? Please help.
Many thanks to you all. (Extra thanks to Mr. Daniels.) Dr. Pastor wrote: > I need a row of 127 bytes that I will use as a > circular buffer. Into the bytes (at unspecified times) > a mark (0 After some time the "buffer" will contain the last 127 marks. > (A pointer will point to the next byte to write to.) > What would be the Pythonic way to do the above? > Thanks for any guidance. -- http://mail.python.org/mailman/listinfo/python-list
Re: Array? Please help.
George Sakkis schrieb: > Diez B. Roggisch wrote: >> Dr. Pastor schrieb: >>> I need a row of 127 bytes that I will use as a >>> circular buffer. Into the bytes (at unspecified times) >>> a mark (0>> After some time the "buffer" will contain the last 127 marks. >>> (A pointer will point to the next byte to write to.) >>> What would be the Pythonic way to do the above? >>> Thanks for any guidance. >> Use a list, use append and slicing on it: >> >> >> max_size = 10 >> buffer = [] >> >> for i in xrange(100): >> buffer.append(i) >> buffer[:] = buffer[-max_size:] >> print buffer >> >> >> Diez > > You're not serious about this, are you ? Tell me why I shouldn't. I presumed he's after a ringbuffer. Ok, the above lacks a way to determine the amount of bytes added since the last read. Add a counter if you want. And proper synchronization in case of a multithreaded environment. But as the OP was sketchy about what he actually needs, I thought that would at least give him a start. Maybe I grossly misunderstood his request. But I didn't see your better implementation so far. So - enlighten me. Diez -- http://mail.python.org/mailman/listinfo/python-list
HTMLParser chokes on bad end tag in comment
The code below results in an exception (Python 2.4.2): HTMLParser.HTMLParseError: bad end tag: "", at line 4, column 6 Should it? The end tag it chokes on is in comment, isn't it? import HTMLParser HTMLParser.HTMLParser().feed(""" """) -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list
Re: why not in python 2.4.3
Rocco: >but does not work with 2.4.3. Define "does not work". -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list
Re: why not in python 2.4.3
This is the problem when I run the function this is the result from 2.3.5 >>> print rss http://purl.org/atom/ns#";>NFE/1.0Google News Italiahttp://news.google.it/"/>Google News ItaliaGoogle Inc.[EMAIL PROTECTED]©2006 Google2006-05-28T19:09:13+00:00 Benedetto XVI: Wojtyla santo subito - Libertà http://www.liberta.it/default.asp?IDG=605282024"/>tag:news.google.com,2005:cluster=41b535fbPrima pagina2006-05-28T11:05:00+00:002006-05-28T11:05:00+00:00