threads, periodically writing to a process

2005-09-29 Thread Adam Monsen
ontinue..." to standard output, *then* sends "\r\n", but extra carriage returns don't hurt, so the first option is probably viable. This is probably something that Expect could handle pretty easily, but I'm just into learning Python for the time being. -- Adam Monsen htt

Re: time.strptime() for different languages

2005-09-19 Thread Adam Monsen
Brett Cannon fixed this bug last week. Thanks, Brett! -- Adam Monsen http://adammonsen.com/ -- http://mail.python.org/mailman/listinfo/python-list

style question: anything wrong with super(type(self), self).f() ?

2005-09-19 Thread Adam Monsen
;in A.f()" By "wrong" I mean, is there any reason why this is just a Bad Idea? Seems helpful to me, if I change the name of the 'B' class, I don't have to change super() calls as well. -- Adam Monsen http://adammonsen.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: strptime() doesn't recognize BST as a valid timezone

2005-09-16 Thread Adam Monsen
10, 17, 26, 0, 2, 222, 1) Works (unsuprisingly) as advertised at the bottom of this page: http://docs.python.org/lib/module-time.html And now I'm a little closer to understanding why. :) -- Adam Monsen http://adammonsen.com/ -- http://mail.python.org/mailman/listinfo/python-list

strptime() doesn't recognize BST as a valid timezone

2005-09-14 Thread Adam Monsen
url: http://groups.google.com/group/comp.lang.python/browse_frm/thread/ce4909280561458b/ ). I did notice that the Python docs mention %Z is deprecated, so http://snipurl.com/hoqz is possibly the best solution available for now. Thoughts? -- Adam Monsen http://adammonsen.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: time.strptime() for different languages

2005-09-13 Thread Adam Monsen
o that bug. -- Adam Monsen http://adammonsen.com/ -- http://mail.python.org/mailman/listinfo/python-list

high performance hyperlink extraction

2005-09-13 Thread Adam Monsen
attr_matches = attrs_re.finditer(d.get('attrs', None)) for match in attr_matches: da = match.groupdict() name = da.get('name', None) a[name] = da.get('value', None) ancs.append(a) return ancs if __name__ == '__mai

Re: disabling TCP connections, just for one script

2005-09-09 Thread Adam Monsen
t f.read() >From this code I get the following exception: "IOError: [Errno socket error] timed out" ...and that fits my needs nicely. -- Adam Monsen http://adammonsen.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: disabling TCP connections, just for one script

2005-09-09 Thread Adam Monsen
Nice!! Since that works, this also works (any socket operations appear to raise an IOError): import socket socket.setdefaulttimeout(0) Thanks! -Adam -- Adam Monsen http://adammonsen.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: using % operator to print possibly unitialized data attributes

2005-09-09 Thread Adam Monsen
#x27; % vals > What's wrong with the obvious version: [...] Oh, that looks nice and clean. I like it. I also found a recipe in the Python cookbook that works great for "dumping" objects: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/137951 (shortened: http://snipurl.com/

using % operator to print possibly unitialized data attributes

2005-09-09 Thread Adam Monsen
_) return 'name="%(name)s" value="%(value)s' % vals j = J() j.name = "j object" print j >8 A couple of questions: * is there a simpler or more elegant way to do this? * how can I get this to work for new-style

Re: disabling TCP connections, just for one script

2005-09-09 Thread Adam Monsen
I know very little about socket programming and even less about sockey.py... any idea what behavior would have to be modified? Further complicating matters (for me), it appears some of the socket programming code is in C, and my C skills are lacking. -- Adam Monsen http://adammonsen.com

Re: "grep" database

2005-09-09 Thread Adam Monsen
ctags indexes procedures/variables in source code, perhaps it would help: http://ctags.sf.net/ -- Adam Monsen http://adammonsen.com/ -- http://mail.python.org/mailman/listinfo/python-list

disabling TCP connections, just for one script

2005-09-09 Thread Adam Monsen
st disabling networking within that virtual machine would possibly work, too. -- Adam Monsen http://adammonsen.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: "zoning" a naive datetime object / daylight savings

2005-08-31 Thread Adam Monsen
The 9-integer time tuple could be fetched using the code posted here: http://snipurl.com/hcvs same URL, not snipped: http://groups.google.com/group/comp.lang.python/msg/65d8f116dfd59dd1 -- Adam Monsen http://adammonsen.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: time.strptime() for different languages

2005-08-31 Thread Adam Monsen
ch back to previous locale locale.setlocale(locale.LC_TIME, old_loc) -->8-- If I try to do further date parsing in the same scope (with a different locale), it fails. Let me know if you have any ideas about why. -- Adam Monsen http

Re: time.strptime() for different languages

2005-08-31 Thread Adam Monsen
last): File "", line 1, in ? File "/usr/lib/python2.4/_strptime.py", line 292, in strptime raise ValueError("time data did not match format: data=%s fmt=%s" % ValueError: time data did not match format: data=10 August 2005 at 17:26 fmt=%d %B %Y at %H:

Re: time.strptime() for different languages

2005-08-31 Thread Adam Monsen
Excellent! Thank you, Fredrik! -- Adam Monsen http://adammonsen.com/ -- http://mail.python.org/mailman/listinfo/python-list

"zoning" a naive datetime object / daylight savings

2005-08-31 Thread Adam Monsen
uot; for times in the Netherlands? Thank you, -Adam References: 1. http://docs.python.org/lib/datetime-datetime.html 2. http://en.wikipedia.org/wiki/Netherlands 3. http://en.wikipedia.org/wiki/Central_European_Time 4. http://pytz.sf.net -- Adam Monsen http://adammonsen.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: time.strptime() for different languages

2005-08-31 Thread Adam Monsen
quot;%d %B %Y om %H:%M") Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/_strptime.py", line 292, in strptime raise ValueError("time data did not match format: data=%s fmt=%s" % ValueError: time data did not match format: data=

time.strptime() for different languages

2005-08-31 Thread Adam Monsen
e month name using a translation table for English to Dutch month names. -- Adam Monsen http://adammonsen.com/ (crossposted to Seattle Python Users List) -- http://mail.python.org/mailman/listinfo/python-list