Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Address already in use')

2009-01-27 Thread Jean-Paul Calderone
E_WAIT state and they are preventing you from binding to the address again in the second run of your app. Setting the SO_REUSEADDR flag on POSIX fixes this problem (don't set it on Windows, though). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: A Twisted Design Decision

2009-01-27 Thread Jean-Paul Calderone
appear to have been necessary. Is there a way to solve this in a more beautiful way? Am I missing something here? Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: A Twisted Design Decision

2009-01-28 Thread Jean-Paul Calderone
On Wed, 28 Jan 2009 02:02:57 -0800 (PST), koranthala wrote: On Jan 27, 9:27 pm, koranthala wrote: On Jan 27, 6:57 pm, Jean-Paul Calderone wrote: [snip] Thank you Jean-Paul. My code is more complex than what I have mentioned. When I mentioned msg.send, the msg object actually gets the

Re: A Twisted Design Decision

2009-01-28 Thread Jean-Paul Calderone
On Wed, 28 Jan 2009 06:30:32 -0800 (PST), koranthala wrote: On Jan 28, 7:10 pm, Jean-Paul Calderone wrote: On Wed, 28 Jan 2009 02:02:57 -0800 (PST), koranthala wrote: >On Jan 27, 9:27 pm, koranthala wrote: >> On Jan 27, 6:57 pm, Jean-Paul Calderone wrote: > [snip] >> T

Re: A Twisted Design Decision

2009-01-28 Thread Jean-Paul Calderone
On Wed, 28 Jan 2009 08:05:13 -0800 (PST), koranthala wrote: On Jan 28, 8:36 pm, Jean-Paul Calderone wrote: [snip] Why isn't the return value of protocol.send propagated back to msg.send? It sounds like it should be. Jean-Paul Thank you very much again Jean-Paul for helping me out.

Re: Sloooooowwwww WSGI restart

2009-01-28 Thread Jean-Paul Calderone
any ideas what might be going on or how to debug this? strace is nice. It sounds like some blocking network operation. rdns can often cause things like this. If you're lucky, strace will point right at the problem. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Results of executing hyperlink in script

2009-01-28 Thread Jean-Paul Calderone
't use os.system here anyway since the poster is interested in getting the contents of the page at the URL. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: persistent TCP connection in python using socketserver

2009-01-29 Thread Jean-Paul Calderone
gh-level behavior you're after (I know that a bunch of people have used it to communicate with Flash, for example). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Get thread pid

2009-01-30 Thread Jean-Paul Calderone
u want to learn more about threads on Linux, you should check out the NPTL documentation. It is a much more reliable authority than any Python documentation regarding the nature of threads on Linux. Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Announcing Pyflakes 0.3.0

2009-01-30 Thread Jean-Paul Calderone
code. It is a handy supplement to your project's test suite. Read more about Pyflakes and the 0.3.0 release on the website: http://divmod.org/trac/wiki/DivmodPyflakes Jean-Paul Calderone Divmod, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Get thread pid

2009-01-30 Thread Jean-Paul Calderone
On Fri, 30 Jan 2009 08:33:53 -0800 (PST), Alejandro wrote: On Jan 30, 9:11 am, Jean-Paul Calderone wrote: [clarification about threads] Thank you for the clarification. I will reformulate my question: pstree and also ntop (but not top) show a number for each thread, like for instance

Re: Odd syntactic NON-error?

2009-01-30 Thread Jean-Paul Calderone
Note the "space" which shouldn't be here---^ The space is irrelevant. >>> object. __init__ >>> object.__init__ is object. __init__ True >>> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: persistent TCP connection in python using socketserver

2009-02-03 Thread Jean-Paul Calderone
er, so im gonna roll my own using the sockets module. For what it's worth, that FAQ entry was grossly out of date. I just deleted it and replaced it with an entry which says the exact opposite. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Running all unit tests

2009-02-06 Thread Jean-Paul Calderone
ere are a bunch of tools for this. I use trial (part of Twisted), which will collect your tests, run them, and report the results (and has helpers for debugging, profiling, and some other stuff) and buildbot. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Portable way to refer to the null device?

2009-02-07 Thread Jean-Paul Calderone
I bet this won't work. It needs to be a "real" file - have a file descriptor or a handle or something. Instead, try opening os.devnull. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: convert the ip packet to and from RS-232 packet

2009-02-09 Thread Jean-Paul Calderone
listenTCP(12345, factory) reactor.run() Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Small socket problem

2009-02-09 Thread Jean-Paul Calderone
u might also want to consider using a higher level socket library than the "socket" module. The socket module exposes you to lots of very low level details and platform-specific idiosyncrasies. You may find that a library like Twisted (<http://twistedmatrix.com/>) will let you write programs with fewer bugs. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: thread. question

2009-02-09 Thread Jean-Paul Calderone
at can be avoided by using non- blocking operations instead. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: "Super()" confusion

2009-02-09 Thread Jean-Paul Calderone
(Child,self).__init__(filePath) TypeError: super() argument 1 must be type, not classobj" What have I done wrong? Thanks in advance for any help. Consider whether you really need to use super(). http://fuhm.net/super-harmful/ Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: "Super()" confusion

2009-02-09 Thread Jean-Paul Calderone
On Mon, 9 Feb 2009 16:18:34 -0800 (PST), Lionel wrote: On Feb 9, 4:04 pm, Jean-Paul Calderone wrote: On Mon, 9 Feb 2009 15:20:05 -0800 (PST), Lionel wrote: >Hello. I've been scouring the web looking for something to clear up a >little confusion about the use of "super()&qu

Re: "Super()" confusion

2009-02-09 Thread Jean-Paul Calderone
e tons of responses from python-dev team members, including Guido Yes. Why the knee-jerk reaction? I simply pointed out a resource which might be helpful to someone trying to learn to use super. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: "Super()" confusion

2009-02-09 Thread Jean-Paul Calderone
how this thing got so much out of control. If anyone starts an intelligent question or remark about super, this essay is thrown in no matter what. Anyone can explain why? You're seriously overreacting. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: "Super()" confusion

2009-02-10 Thread Jean-Paul Calderone
On Tue, 10 Feb 2009 19:40:56 + (UTC), Benjamin Peterson wrote: Marc 'BlackJack' Rintsch gmx.net> writes: On Tue, 10 Feb 2009 02:02:43 +, Benjamin Peterson wrote: > Jean-Paul Calderone divmod.com> writes: >> Consider whether you really need to use super

Re: Escaping my own chroot...

2009-02-11 Thread Jean-Paul Calderone
o control the process before the chroot happens, breaking out is even simpler in your case (just open / before you chroot in the first place). forking before doing the chroot may still be a good idea, but it's not the only solution. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: select.poll.poll() never blocks

2009-02-11 Thread Jean-Paul Calderone
in a miserable state, so you probably shouldn't use it. That leaves you with threads. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't load smtplib

2009-02-12 Thread Jean-Paul Calderone
= func(*args) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/urllib2.py", line 506, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 401: Unauthorized ( The server requires authorization to fulfill the request. Access to the Web server is denied. Contact the server administrator. ) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads in PyGTK: keep typing while ping-ing

2009-02-16 Thread Jean-Paul Calderone
is not updated. If you want to keep using threads, then you need a way to avoid joining the threads until you know they're done. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: os.fdopen giving "Invalid Argument" from pipes

2009-02-19 Thread Jean-Paul Calderone
send = os.fdopen(server_send,"w") OSError: [Errno 22] Invalid argument really confused about why this isn't working - running on Linux with python 2.5.2 Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: FTP libs for Python?

2009-02-20 Thread Jean-Paul Calderone
ludes FTP and SFTP support. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Version upgrade blocked mentally

2008-11-29 Thread Jean-Paul Calderone
x27;) >>> type(b'') >>> from __future__ import unicode_literals >>> type('') >>> type(u'') >>> type(b'') >>> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Project structure - Best practices

2008-11-30 Thread Jean-Paul Calderone
fore I have to use absolute paths to import it and this works only, when I run rpgDirectory.py. When I use pychecker, it can't import this module and fails. Any suggestions, how can I avoid this and what structure should I use? http://jcalderone.livejournal.com/39794.html Jean-P

Re: schizophrenic view of what is white space

2008-12-04 Thread Jean-Paul Calderone
lp", "copyright", "credits" or "license" for more information. >>> import re >>> print re.compile(r'\s').search(u'a\xa0b') None >>> print re.compile(r'\s', re.U).search(u'a\xa0b') <_sre.SRE_Match object at 0xb7dbb3a0> >>> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 read() function

2008-12-04 Thread Jean-Paul Calderone
f.read() >>> d=f.read() >>> d=f.read() Did you think about what this does? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: schizophrenic view of what is white space

2008-12-04 Thread Jean-Paul Calderone
avior would be a good default: re.match(r'\d', u'\u0660', re.UNICODE) <_sre.SRE_Match object at 0xb7da0250> What digit is \u0660, out of 0-9? Hard to say. Why's it hard? int(u'\u0660') == 0 :) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking if an int fits in 32 bits?

2008-12-04 Thread Jean-Paul Calderone
Python code? Or is there some cleaner way to do this? How about simple bounds checking? An integer fits in an unsigned 32bit representation if it is greater than or equal to 0 and less than 2 ** 32. The bounds for the sizes are similarly simple to determine and check. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalent of 'wget' for python?

2008-12-08 Thread Jean-Paul Calderone
sn't portable on Windows. I'm hoping the core python library has a library for this. Note that I'll be using Python 3.0. Module urllib2 There isn't such a module in Python 3.0. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: StringIO in 2.6 and beyond

2008-12-10 Thread Jean-Paul Calderone
('Second line.', file=output) Maybe a combination of this and functools.partial as was suggested before. At least the necessary edits would be at the top of the program. See http://bugs.python.org/issue4618, there's a comment with a workaround for this problem. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: %s place holder does not let me insert ' in an sql query with python.

2008-12-15 Thread Jean-Paul Calderone
string interpolation as in the code you included in your original post (or in some of the other responses you received). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: AIM client code for Python?

2008-12-16 Thread Jean-Paul Calderone
n TOC implementation to suggest? You need an OSCAR-based AIM library. AOL discontinued TOC support several years ago. No TOC-based client can work on the AIM network. Twisted includes a (somewhat crufty) OSCAR implementation. There are probably also other Python OSCAR implementations. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Can anyone suggest a good HTTP/1.1 web client?

2008-12-16 Thread Jean-Paul Calderone
nd I was wondering whether python provides it straight up. If you'd like to help out with the new Twisted HTTP client, that would be wonderful. Even if you can just try it out and report any problems you run into, that would be immensely helpful. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Can anyone suggest a good HTTP/1.1 web client?

2008-12-16 Thread Jean-Paul Calderone
On Tue, 16 Dec 2008 18:47:41 -0800 (PST), Kottiyath wrote: If you'd like to help out with the new Twisted HTTP client, that would be wonderful.  Even if you can just try it out and report any problems you run into, that would be immensely helpful. Jean-Paul I would love to help out

Re: getting object instead of string from dir()

2008-12-17 Thread Jean-Paul Calderone
st = dir() for el in lst: print el + '\t' + str(eval('type(%s)'%el)) It works, now I am curious if there is a better way. What about this: for name, obj in vars().iteritems(): print name, obj Christian Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Transferring a file over sockets

2008-12-17 Thread Jean-Paul Calderone
. recv(n) does not necessarily return an n-length string. Read the socket documentation more carefully and try fixing those issues. Or try using Twisted which presents a somewhat easier API to use. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: confused about __str__ vs. __repr__

2008-12-18 Thread Jean-Paul Calderone
ce) - using the __repr__ of the contained objects makes it easier for the human to understand what's in the dict. Using __str__ would make it much harder in many cases. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: IMAP: How to implement GMail-like threaded conversations view

2008-12-19 Thread Jean-Paul Calderone
want to examine the structure of the messages you retrieve. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python 3.0 string formatting - really necessary?

2008-12-19 Thread Jean-Paul Calderone
7;ing of Python 3 code? Perhaps it will, someday, but I suspect it will provide a JIT for Python 2 long before. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Event Driven programming - Doubts

2008-12-22 Thread Jean-Paul Calderone
) having new threads. There is blocking code - but just in one place. For example, http://twistedmatrix.com/trac/browser/trunk/twisted/internet/selectreactor.py#L93 Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: select.select and socket.setblocking

2008-12-30 Thread Jean-Paul Calderone
t, merge the results, and treat them all as writeable. Or use a higher-level library that deals with all the asinine details for you. ;) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Triple quoted string in exec function ?

2008-12-30 Thread Jean-Paul Calderone
^ SyntaxError: invalid syntax >>> And no, putting parenthesis around the expression given to exec doesn't make a difference: >>> x = exec("foo") File "", line 1 x = exec("foo") ^ SyntaxError: invalid syntax >>> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: select.select and socket.setblocking

2008-12-30 Thread Jean-Paul Calderone
king or not. In an event-loop, blocking is generally not allowed. If you're careful, it's possible to avoid blocking, even when using a blocking socket, at least for AF_INET, SOCK_STREAM sockets. Of course, it's easier to avoid blocking by using a non-blocking socket. Jean-Pa

Re: select.select and socket.setblocking

2008-12-30 Thread Jean-Paul Calderone
On Tue, 30 Dec 2008 15:55:51 -0500, Jean-Paul Calderone wrote: On Tue, 30 Dec 2008 14:41:17 -0600, Grant Edwards wrote: On 2008-12-30, Francesco Bochicchio wrote: 3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in select between blocking and non-blocking mode. The

Re: select.select and socket.setblocking

2008-12-31 Thread Jean-Paul Calderone
he sender passed to one call of send (until the sender starts to pass really huge strings to send, then it'll get split up) just because the network has lots of capacity compared to the traffic you're putting on it. However, even on a LAN it's not guaranteed, and on the internet, it's extremely likely that this won't happen most of the time. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: If your were going to program a game...

2009-01-02 Thread Jean-Paul Calderone
an RPython to JavaScript compiler. RPython and Python are different languages. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Doubt on creating threads

2009-01-03 Thread Jean-Paul Calderone
compared to creating and destroying threads all the time. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python callback functions and static methods

2009-01-05 Thread Jean-Paul Calderone
d what was wrong with your `Data` class, so I won't bother going into that. I will recommend that you take a look at Deferred and perhaps use it, rather than implementing something yourself: http://twistedmatrix.com/projects/core/documentation/howto/defer.html Jean-Paul -- http://mail.pyt

Re: Defer problem

2009-01-07 Thread Jean-Paul Calderone
he `DeferredList´ to only fire after all of the wrapped deferreds have fired, don't pass this flag. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: ssl module - how can I accept SSLv3 and TLSv1 protocols only?

2009-01-07 Thread Jean-Paul Calderone
ywhere, nor any way to specify any extra flags. Oring PROTOCOL_SSLv3 together with PROTOCOL_TLSv1 is almost certainly not the right approach, anyway (as you saw with your tests). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: HARD REAL TIME PYTHON

2008-10-06 Thread Jean-Paul Calderone
enchmark above demonstrates throughput, not minimum (or maximum, or average, or any other statistic) response latency, which is what the OP was really asking about. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: HARD REAL TIME PYTHON

2008-10-06 Thread Jean-Paul Calderone
On Tue, 7 Oct 2008 12:10:44 +1000, James Mills <[EMAIL PROTECTED]> wrote: On Tue, Oct 7, 2008 at 11:48 AM, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: Indeed, this looks wrong - or at least inconclusive. The benchmark above demonstrates throughput, not minimum (or maximum, or

Re: How do you get rid of useless warnings?

2008-10-07 Thread Jean-Paul Calderone
fixed in 2.6, since both of these warnings are errors in 2.6. ;) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading from stdin

2008-10-08 Thread Jean-Paul Calderone
mode. (I was trying to put the file object in non-blocking mode to test next()'s behavior). ??Ideas? Take a look at http://twistedmatrix.com/trac/browser/trunk/twisted/internet/fdesc.py Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How to calculate two time?

2008-10-08 Thread Jean-Paul Calderone
rom epsilon.extime import Time >>> Time.fromISO8601TimeAndDate("2008-10-08T14:05:16.029246+00:00") - Time.fromISO8601TimeAndDate("2007-03-27T08:54:43+08:00") datetime.timedelta(561, 47433, 29246) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Twisted Matrix and multicast broadcast

2008-10-09 Thread Jean-Paul Calderone
of them. If you want to send something to all clients listening on that address, then that's the address to pass to transport.write. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: About print exception message

2008-10-09 Thread Jean-Paul Calderone
ier than writing that big function: try: open(u'\N{WHITE SMILING FACE}') ... except IOError, e: print str(e).decode('unicode-escape') ... [Errno 2] No such file or directory: u'☺' Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggestion for the PythonDevelopment for next version

2008-10-13 Thread Jean-Paul Calderone
ing a random new attribute to arbitrary objects any time they happen to end up in a for loop would be catastrophically terrible. Consider the enumerate builtin, instead. for i, e in enumerate('abcd'): ... print i, e ... 0 a 1 b 2 c 3 d Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Linux.com: Python 3 makes a big break

2008-10-18 Thread Jean-Paul Calderone
things to stdout (or elsewhere) in Python 2.5, making the Python 3.x change largely a non-feature. ;) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: add method to class dynamically?

2008-10-22 Thread Jean-Paul Calderone
thon has to look up to satisfy some other operation, such as len or +, to be a special method and don't rely on _either_ it being looked up on the instance or it _not_ being looked up on the instance (ie, don't put a method there and expect it not to be called). The methods which are actually considered special by CPython can change and has in the past. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: how to pass a dictionary (including chinese characters) through Queue as is?

2008-10-25 Thread Jean-Paul Calderone
;, 'b': 1232} Try printing b before you put it into the Queue. The Queue isn't doing anything to the objects you pass through it, you're just surprised at how repr() is presenting the un-altered data. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: memory mapped tar file contents

2008-11-12 Thread Jean-Paul Calderone
meaningfully use mmap to speed up your application. The data has to be uncompressed and interpreted before you can get the application data. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Text based screens without ncurses

2008-11-13 Thread Jean-Paul Calderone
e thing that you want to do? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Text based screens without ncurses

2008-11-13 Thread Jean-Paul Calderone
On Thu, 13 Nov 2008 20:16:58 +0200, Mirat Can Bayrak <[EMAIL PROTECTED]> wrote: On Thu, 13 Nov 2008 12:14:10 -0500 Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: Why don't you want to use one of these libraries for doing the thing that you want to do? mmm lets say i want

Re: using "private" parameters as static storage?

2008-11-13 Thread Jean-Paul Calderone
cts* are for. Not exclusively, generators also preserve state. def _spam(): count = 1 while 1: yield "spam " * count count += 1 spam = _spam.next() Surprise - generators are objects. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with writing fast UDP server

2008-11-20 Thread Jean-Paul Calderone
On Fri, 21 Nov 2008 00:20:49 -0200, Gabriel Genellina <[EMAIL PROTECTED]> wrote: En Thu, 20 Nov 2008 14:24:20 -0200, Krzysztof Retel <[EMAIL PROTECTED]> escribió: On Nov 20, 4:00 pm, [EMAIL PROTECTED] wrote: On 20 Nov, 16:03, Krzysztof Retel <[EMAIL PROTECTED]> wrote: > I am struggling writing

Re: Extract CDATA Node

2009-02-24 Thread Jean-Paul Calderone
simpler ways, though, based on other XML libraries. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: "Battleship" style game

2009-02-25 Thread Jean-Paul Calderone
the `unittest´ module in the standard library and take things to the next level. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: EOL for sys.stdin.readline() and raw_input()

2009-02-26 Thread Jean-Paul Calderone
ch an implementation would deal with the fact that telnet encodes \r as \r\0 for you. Twisted includes a telnet implementation, as well as facilities for reading stdin asynchronously (which will let you avoid indefinite hangs). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I know when a sub-process is effectively initialized?

2009-02-26 Thread Jean-Paul Calderone
dy. The parent then just waits for those bytes. It looks like you entirely control the child in this case, so that should be possible here. Alternatively, maybe by "properly initialized" you mean something very specific about how subprocess.Popen creates processes. If so

Re: EOL for sys.stdin.readline() and raw_input()

2009-02-26 Thread Jean-Paul Calderone
On Thu, 26 Feb 2009 23:32:13 +0100, jkv wrote: Jean-Paul Calderone wrote: sys.stdout.write('Password: '); #IAC DO ECHO sys.stdout.write('\xFF\xFB\x01') password = raw_input() If the client sends 'qwerty\r\n' everything is fine and the password ge

Re: socket problem

2009-03-02 Thread Jean-Paul Calderone
ng which would cause a correctly written server (in C or any other language with BSD socket APIs) to fail. I suggest investigating how telnet and your Python client differ, then looking into the C code to find out how that difference can trigger a bug in it. Jean-Paul -- http://mail.python.org/ma

Re: Python3 on the Web

2009-03-05 Thread Jean-Paul Calderone
ython isn't available, cgi is said to be slow, mod_wsgi looks complicated... What would you suggest? Try Python 2.x instead. If you go with Python 3, you're going to run into the same limited library selection over and over. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Unusual Python interpreter problem with os.fork()

2009-03-06 Thread Jean-Paul Calderone
yright", "credits" or "license" for more information. import os pid = os.fork() As soon as this returns, you have two CPython processes reading from stdin and writing to stdout. They fight over your input and their output gets interleaved in non-deterministic ways. Basical

Re: Should I use stackless python or threads?

2009-03-06 Thread Jean-Paul Calderone
On Fri, 6 Mar 2009 14:50:51 -0800, Minesh Patel wrote: I am trying to figure out the best approach to solve this problem: I want to poll various directories(can be run in the main thread). Once I notice a file has been added to any directory, I grab a lock, spawn a thread to go perform the nece

Re: download x bytes at a time over network

2009-03-16 Thread Jean-Paul Calderone
en you can probably see the behavior you were expecting. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: ValueError: filedescriptor out of range in select()

2009-03-17 Thread Jean-Paul Calderone
is to work around a bug in CPython on Windows where a process in a blocking read cannot be interrupted by C-c in the console? If that's the case, there may be other approaches to solving the problem (like fixing the bug in CPython which causes this). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: download x bytes at a time over network

2009-03-17 Thread Jean-Paul Calderone
ntrol (you might have something like 32kb or 64kb level control). What abt in Python3 ? It seems to have some header like the one below : b'b495 - binary mode with 46229 bytes ? Or is it something else ? That's just a bug in urllib in Python 3.0. Jean-Paul -- http://mail.python.org/mai

Re: ValueError: filedescriptor out of range in select()

2009-03-17 Thread Jean-Paul Calderone
etter choice for me, except that Python is much more elegant. :-) I'm sure people will tell you that this is a good use of threads and that Python is up to the task. I think it's a bad use of threads, but with a different approach, I still think Python is up to the task. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: download x bytes at a time over network

2009-03-17 Thread Jean-Paul Calderone
On Tue, 17 Mar 2009 15:17:56 + (UTC), "R. David Murray" wrote: Jean-Paul Calderone wrote: On Tue, 17 Mar 2009 12:15:23 +0530, Saurabh wrote: >> This isn't exactly how things work.  The server *sends* you bytes.  It can >> send you a lot at once.  To some exte

Re: Threads not Improving Performance in Program

2009-03-19 Thread Jean-Paul Calderone
processes instead, if there really is more hardware that's sitting idle with your single threaded version. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3143: Standard daemon process library (was: Writing a well-behaved daemon)

2009-03-20 Thread Jean-Paul Calderone
ust surely fail. For example, uid/gid setting is broken. I'd recommend adding an automated test suite, fixing all the issues that come up during that process, and then asking for scrutiny again. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3143: Standard daemon process library

2009-03-20 Thread Jean-Paul Calderone
ed as could be (it's also only 14 lines long). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Async serial communication/threads sharing data

2009-03-21 Thread Jean-Paul Calderone
t you integrate with a GUI toolkit. Since Twisted encourages you to write programs which deal with things asynchronously in a single thread, if you use it, your concerns about data exchange, locking, and timing should be addressed as a simple consequence of your overall program structure. Je

Re: PEP 3143: Standard daemon process library

2009-03-21 Thread Jean-Paul Calderone
On Sun, 22 Mar 2009 10:19:58 +1100, Ben Finney wrote: Jean-Paul Calderone writes: The biggest shortcoming seems to be a complete lack of unit tests. A full unit test suite is in the source distribution's ‘tests/’ directory. You can run it with ‘python ./setup.py test’. Of course th

Re: Async serial communication/threads sharing data

2009-03-22 Thread Jean-Paul Calderone
On Sun, 22 Mar 2009 03:13:36 -0700 (PDT), Nick Timkovich wrote: On Mar 21, 9:19 pm, Jean-Paul Calderone wrote: On Sat, 21 Mar 2009 13:52:21 -0700 (PDT), Nick Timkovich wrote: >I've been working on a program that will talk to an embedded device >over the serial port, using some b

Re: Async serial communication/threads sharing data

2009-03-22 Thread Jean-Paul Calderone
ets paused, and when the buffer is empty again, it gets resumed. Hope this helps! Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Async serial communication/threads sharing data

2009-03-23 Thread Jean-Paul Calderone
On Mon, 23 Mar 2009 05:30:04 -0500, Nick Craig-Wood wrote: Jean-Paul Calderone wrote: [snip] In the case of a TCP to serial forwarder, you don't actually have to implement either a producer or a consumer, since both the TCP connection and the serial connection are already both prod

Re: pickle.load() extremely slow performance

2009-03-23 Thread Jean-Paul Calderone
onds, an 1875% improvement. Surely you mean a 94.7% improvement? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3143: Standard daemon process library

2009-03-24 Thread Jean-Paul Calderone
On Tue, 24 Mar 2009 15:42:46 +1100, Ben Finney wrote: Jean-Paul Calderone writes: [snip] An additional feature which would be useful for the library to provide, however, would be the setting of euid and egid instead of uid and gid. This is necessary, for example, to write an SSH daemon

Re: Unit testing frameworks

2009-03-24 Thread Jean-Paul Calderone
://twistedmatrix.com/trac/wiki/TwistedTrial Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Async serial communication/threads sharing data

2009-03-25 Thread Jean-Paul Calderone
On Tue, 24 Mar 2009 22:20:49 -0700, John Nagle wrote: Jean-Paul Calderone wrote: On Mon, 23 Mar 2009 05:30:04 -0500, Nick Craig-Wood wrote: Jean-Paul Calderone wrote: [snip] After bringing in all the heavy machinery of Twisted, you're still polling at 10Hz. That's disappointi

Re: Async serial communication/threads sharing data

2009-04-11 Thread Jean-Paul Calderone
On Wed, 25 Mar 2009 22:23:25 -0700, John Nagle wrote: Jean-Paul Calderone wrote: On Tue, 24 Mar 2009 22:20:49 -0700, John Nagle wrote: Jean-Paul Calderone wrote: On Mon, 23 Mar 2009 05:30:04 -0500, Nick Craig-Wood wrote: Jean-Paul Calderone wrote: [snip] After bringing in all the

<    7   8   9   10   11   12   13   14   15   16   >