onnection has been lost
If you expect a particular number of bytes, you need to call recv()
multiple times and collect the returned strings until you have as many
bytes as you wanted.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
point out his
>error.
>
>Does Python (or SciPy or ..) offer this feature?
>
>Thanks for your help.
>
>
> Abraham
>
You might be interested in Unum.
http://home.tiscali.be/be052320/Unum.html
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
py line 91.
Hi. You might want to post this to the twisted-web mailing list, instead.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
Ugg, wrong list obviously. Please disregard. Sorry.
--
http://mail.python.org/mailman/listinfo/python-list
thread. Several projects make use of this feature extensively, so
while I wouldn't recommend it, it should certainly work.
Perhaps you did something wrong in setting it up, or perhaps you have found
a bug. Can you post a minimal example to reproduce this to Twisted's bug
tracker?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
#x27;t work on any widespread configuration
I am aware of. In general, most individual solutions are only effective on
a portion of existing configurations. A robust solution must employ multiple
techniques.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ed as an application
API to an implementation of something like what the poster is requesting,
inasmuch as many people find them to be a useful way to split a task up
into small pieces. However, aside from syntactic convenience, they don't
really bring anything fundamentally different to the table.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ce(u"hello", types.UnicodeType)
>True
>
>...or, if you don't want to qualify them with "types." each time,
>you can use
>
> >>> from types import StringType, UnicodeType
>
>to bring them into the local namespace.
>>> str is types.StringType
True
>>> unicode is types.UnicodeType
True
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
nd, it performs no error handling at all, so if the SIGCHLD
for thread 1's process is delivered to thread 2, it may cause the wait call
to fail with an EINTR OSError. Whether this is actually possible or not
depends on what signal handlers, if any, have been installed, as well as the
unde
r it
is likely that the output is being viewed by a human or a program.
Since you are running ls with popen, ls decides it is a program, and elides
the colors.
Try os.popen("ls --color=yes").
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
simple terminal emulator (to help you keep
track of what vi has done to your virtual terminal).
API docs for insults:
http://twistedmatrix.com/documents/current/api/twisted.conch.insults.html
And for the telnet implementation:
http://twistedmatrix.com/documents/current/api/twisted.conch.telnet
2147483647
>>> c.next()
-2147483648
>>>
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
e iptables/netfilter
>mailing lists?
Why do you want to use inotify?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On 1 Dec 2006 06:07:28 -0800, Salvatore Di Fazio <[EMAIL PROTECTED]> wrote:
>Hi guys,
>I'm looking for a tutorial to make a client with a i/o multiplexing and
>non blocking socket.
>
>Anybody knows where is a tutorial?
http://twistedmatrix.com/projects/core/documentatio
ions are more lower level, this is
>simply the first client/server application ive created and am doing so
>in a language ive never used before ;)
http://dsd.lbl.gov/gtg/projects/pyGridWare/ might be of some use.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
tion with twisted?
>thanks in advance
>Maxime
Don't do this. You don't need separate threads for client and server
code. There is only one reactor, and you can only run it in one thread.
Use it for both your client and your server.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
eter, then send a patch to the
>maintainers (and hope they notice it in their inboxes), while the
>maintainers themselves could probably "fix" the problem in two minutes
>flat. No thanks!
And I have some laundry that I would like you to do for me. Let me know
when a convenien
mation.
You can find a simple example of using Twisted's SMTP client here:
http://twistedmatrix.com/trac/browser/trunk/doc/mail/examples/smtpclient_tls.py
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On 6 Dec 2006 06:34:49 -0800, antred <[EMAIL PROTECTED]> wrote:
>I've noticed something odd in Python 2.5, namely that the 2 argument
>version of 'assert' is broken. Or at least it seems that way to me.
>
>Run the following code in your Python interpreter:
>
>myString = None
>
>assert( myString, 'T
gt;
Twisted Conch includes support for both SFTP servers and clients.
http://twistedmatrix.com/trac/wiki/TwistedConch
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
and this set option ?
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT,ldap.OPT_X_TLS_NEVER)
HTH
Laszlo Nagy a écrit :
> By the way, I already tried the set_option function, but I still get the
> same error.
>
>
> import ldap
> import local
>
> ldap.set_option(ldap.OPT_X_TLS_ALLOW,1)
> ldap.set_op
>> It's not surprising that no one uses this stuff for serious work.
>
>I have seen enough libraries that use doctest. Zope, Twisted and Paste
>are some of the popular Python projects in that use it. Epydoc supports
>it as well.
Just as a factual correction, Twisted does not u
: error: cannot convert ‘unsigned int ()(unsigned int)’ to ‘void
()(double)’ in assignment
make: *** [foo] Error 1
[EMAIL PROTECTED]:~/Scratch/Source/shedskin-0.0.16$
So yes, it seems that what ShedSkin supports is pretty distant from what
a seasoned Python developer might expect, aside from syntactic constructs.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
sendmsg to send the packet with the extension header.
>Does python support the extension header processing?
Python doesn't expose sendmsg. There are several third-party
modules which do, though. Googling for "python sendmsg" turns
up some useful links.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
You just need to turn things around:
>>> def foo(a, b, c):
... return a, b, c
...
>>> args = range(2)
>>> foo(c=2, *args)
(0, 1, 2)
>>>
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
has been modified, at least according
to your argument. Do you often worry about it, though? And if not, has it
ever come back to bite you? If so, perhaps more than just built-in classes
should be restricted in this way? If not, why should built-ins have the
restriction?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
the
different functions and methods of your program so that they can inspect
and mutate it. If you use globals, you will end with code which is harder
to unit test and harder to re-use.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
h more easily:
>>> import numarray
>>> buf = numarray.array('')
>>> buf.tostring()
''
>>> (buf ^ 123).tostring()
'\x03\x03\x03\x03\x03\x03\x03\x03'
>>>
In any case, you can at lea
mProject
Shtoom is LGPL. Sine borrows some code from it, so it is probably LGPL as well.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ap4 import Query
>>> Query(after='01-Jan-2007')
'(AFTER "01-Jan-2007")'
>>>
Since documentation was brought up, I'll point out Query's docs too, since
that might help shed some further light on what's possible.
http://twistedmatrix.com/documents/current/api/twisted.mail.imap4.html#twisted.mail.imap4.Query
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
to this implementation:
binary = lambda i,c = (lambda i,c: i and (c(i>>1, c) + str(i&1)) or ''): c(i,c)
Although I won't claim it is the best solution.
Fortunately for you, I guess, it looks like Python 2.5 will have either a bin()
builtin or a '%b' format charac
strToReplace = "for\(" + pattern + "\1\;"
>
>fNew.write( l.replace( strToFind, strToReplace) )
>
>print l
>
>fNew.close()
>
str.replace() does not support regular expressions. Take a look at the re
module.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
#x27;)
internet.UDPServer(
12345,
TkDisplayProtocol(Tk.Tk())).setServiceParent(application)
Save to "udptk.tac" and run using "twistd -noy udotk.tac".
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
r/bin/xterm",
"-e",
"/opt/itt/ncbr/bin/linux/bar")
Each argumnent after the 2nd to spawnlp() is an argument to the program you are
running. passing "-e /path" as a single argument is the same as trying to do
this on the command line:
xterm "-e /path"
which I think you will find fails in the same way.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
n remotely transparent. Stop chasing a fantasy,
or start doing ground-breaking research to advance the state of the art.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
lassmethod
>def meth(cls, self):
>#do stuff
>
>but it didn't work. Any suggestions?
Hint: decorators usually return functions. What does your decorator return?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
erstand what's going on?
Python 2.4.2 (#2, Sep 30 2005, 21:19:01)
[GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo(): pas
On Fri, 3 Feb 2006 15:27:51 -0500, Terry Reedy <[EMAIL PROTECTED]> wrote:
>
>"Magnus Lycka" <[EMAIL PROTECTED]> wrote in message
>news:[EMAIL PROTECTED]
>> [EMAIL PROTECTED] wrote:
>> Today, Python has a syntactic shortcut. If 'a' is an
>> instance of class 'A', a.f(x,y,z) is a shortcut for
>> A.f(
t;- a way to hide and show the cursor
>- a way to detect when the terminal is resized
>- a way to query the terminal size
You might be interested in Twisted Conch's insults package. I haven't followed
this thread closely, so I'm not sure if it covers all your requirem
garbage collection purposes.
It's moot, since the garbage collector can collect cycles:
Make a cycle:
>>> a = []
>>> b = []
>>> a.append(b)
>>> b.append(a)
Get rid of all references to all objects participating in it:
>>> del a, b
Explicitly invoke the garbage collector in order to observe the number of
objects it cleans up:
>>> gc.collect()
2
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
gether and not use any polling loops.
>
>i.e. consumer goes to sleep while data buffer is empty, producer
>produces and signals condition object, consumer wakes up and consumes.
What makes you think process isn't implemented to notify a condition, and
getdata isn't implemented to wait on one? :)
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
4096 Feb 16 14:15 c
drwxr-xr-x 2 exarkun exarkun 4096 Feb 16 14:15 d
226 Transfer Complete.
ftp> quit
221 Goodbye.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
c 'print ' + ''.join(map(chr, [
95, 95, 98, 117, 105, 108, 116, 105, 110, 115, 95, 95]))
"""
You can come up with a long list of restrictions to impose, and maybe that will
be good enough. But making it /perfect/ is a Herculean task, as is maintaining
it as new Python releases are made, and auditing it every time you add a new
piece of code to your system.
Just keep that in mind if you decide to pursue this.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
print dir # comes from "enclosing scope" - foo's scope
Hope this helps,
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 18 Feb 2006 12:36:06 +1100, Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> [snip]
>
>Commenting and uncommenting should be two different commands: the whole
>point of nested comments is that it allows you to comment a block of text
>which may already contain comments. Having one command do bo
dedicated Twisted
mailing list you can use as a resource:
<http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web>.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
CONVERT_TO_LONG(w, b);
longprod = a * b;
doubleprod = (double)a * (double)b;
doubled_longprod = (double)longprod;
I think the rest of the function is probably irrelevant, as far as your
question goes.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
mething, the timeit module is your friend. Discussions about *why* you
>get certain performance results are then useful.
But this stuff is all still true :)
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
wto/producers.xhtml>).
It might be beneficial to direct follow-up questions to the Twisted list
(<http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python>), since
more people familiar with this will be paying attention there.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
= wmi.WMI ()
for s in c.Win32_Service ():
if s.State == 'Stopped':
print s.Caption, s.State
gives me the same result as above.
Could someone please point me in the right direction to find out what's
wrong?
Thanks in advance,
J-S
--
___
there any reason why whitespace between the method
name and parameter list parentheses isn't good? Because the code I
posted before was copy-pasted from Tim Golden's site
(http://tgolden.sc.sabren.com/python/wmi.html) and the spaces were there.
Thanks,
J-S
--
__
very glad to address it.
>
>
Not at all, this is a small project I'm using to try and learn Python...
I'm currently on summer break before I start my Masters, so I have the
luxury of keeping this on the back burner until I find a fix... Thanks
for your help!
J-S
--
___
Jean-Sébastien Guay [EMAIL PROTECTED]
http://whitestar02.webhop.org/
--
http://mail.python.org/mailman/listinfo/python-list
have no problem with trying out other
suggestions.
Thanks a lot, just by your small scripts I've already learned a lot more
about Python!
J-S
--
___
Jean-Sébastien Guay [EMAIL PROTECTED]
http://whitestar02.webhop.org/
--
http://mail.python.org/mailman/listinfo/python-list
sterday, with the same results. It would
seem (from what I can understand) that c.ExecQuery() just makes a list
of proxy objects, and that when you call Count on the set, it has to
create them all for real and that's where it fails when reaching the
"bad" service.
Thanks again, loo
exe? (yes, I have seen so-called "locked
down" machines with a "program black list" that were that stupid)
Worth a try! :-)
And then you could rename ssh.exe to explorer.exe, perl.exe to java.exe
or something funny like that...
J-S
--
_
us I/O
>using my own engine (multitask), so I need a HTTP package that won't
>insist on doing the I/O for me.
>
Neither of Twisted's HTTP implementations insist on doing the I/O
for you. All protocols in Twisted are independent of their transport.
You can feed them data any way
tion.sendmail("[EMAIL PROTECTED]","[EMAIL PROTECTED]",msg)
> File "/usr/lib/python2.5/smtplib.py", line 684, in sendmail
>raise SMTPSenderRefused(code, resp, from_addr)
>smtplib.SMTPSenderRefused: (530, '5.7.0 Must issue a STARTTLS command first
>m75sm2193378wrm', '[EMAIL PROTECTED]')
>
>Where am I going wrong?
>
Notice that in response to the STARTTLS you sent, you received this
response:
503 5.5.1 EHLO/HELO first m75sm2193378wrm
The command was rejected and ignored and TLS was not initiated. You need
to send the STARTTLS later.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
he second line is still
>in the sending buffer, and not reach the server side.
There is no buffer you can flush. Also, you forgot to check the return
value of the send method. It is important. You might want to look at
the sendall method. Or you might want to check out Twisted.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
t;The interactive session is different from running in the IDE (am using
>ActiveState's Visual Python) which exits just after the `a[b]=1` without
>calling hook.
>
>Am I missing something? Perhaps this is the wrong approach? I want Python to
>check a specific set of locals first, before checking globals. For instance:
>
Yes. Python doesn't have restartable exceptions. Perhaps you would like to
take a look at CL or Smalltalk?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ther signals or threads. Interaction between the two is
very complicated and, as you've noticed, varies across platforms. Twisted
is solving the problem for you here by letting you do I/O without using
threads, making signals *almost* simple.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ion into english will somehow help reveal
how this behavior is consistent.
For what it's worth, I agree that scoping in Python is not ideal and this
is a good example of an area where that shortcoming causes surprises.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
iding.
You might be able to find a way to avoid this import behavior if you get
a little creative, but I doubt it's worth the effort or the trickery.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ent it.
You described how threads introduce a problem in your program -- that of
generating a sequence of sequential identifiers -- but you didn't describe
the problem that threads are solving in your program. Maybe you don't
need them at all? What led you to threading in the first place?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ving in your program. Maybe you don't
>> need them at all? What led you to threading in the first place?
>>
>> Jean-Paul
>
>Well, the problem I thought they would solve is ensuring everyone got
>a sequential number. But I suppose they wouldn't solve that, since
&
ss) ?
>
>eval() is a function, and it only evaluates EXPRESSIONS, not code blocks.
Actually, that's not exactly true:
>>> x = compile('def foo():\n\tprint "hi"\n', '', 'exec')
>>> l = {}
>>> eval(x, l)
>>> l['foo']()
hi
>>>
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
e never tried
>this, but it is my platform independent idea.
select won't work on stdin on windows, and it won't work to read anything
less than a line on posix either, unless you put the pty into unbuffered
mode first (but then it will work).
Twisted has a more abstract API for this kind
On Tue, 26 Jun 2007 21:48:46 -0700, Adam Atlas <[EMAIL PROTECTED]> wrote:
>Does anyone have a copy of PyKQueue 2.0 around? The site it's supposed
>to be on (http://python-hpio.net/trac/wiki/PyKQueue) is down.
>
>--
>http://mail.python.org/mailman/listinfo/python-list
>
http://twistedmatrix.com/tra
ttachments and other MIME features, you can use the stdlib email
package to parse the message into a structured form and then process it
appropriately.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
will be used. Such assumptions are called "preconditions", which are
>an understood notion in software engineering and by me when I write
>software.
You realize that Python has exceptions, right? Have you ever encountered
a traceback object? Is one of your preconditions that no one
or the one with a #! at the top which gets respected, or the .py file
on Windows which is associated with python.exe as its interpreter),
but that it doesn't save the results of this compilation to a file to
be used next time?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IReactorTime.html
http://twistedmatrix.com/documents/current/api/twisted.internet.task.LoopingCall.html
Hope this helps,
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
e closed (for example, sending a message which the remote side
decides is invalid and causing it to close the socket explicitly from its
end). It's difficult to make any specific suggestions in that area without
knowing exactly what your program does.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
g/ref/strings.html for more information.
I wonder if the OP was asking how to spell the one-length string \?
In that case, the answer is that it can't be done using raw strings,
but "\\" does it. Backslash escapes aren't interpreted in raw strings,
but you still can't end a raw string with a backslash.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 03 Jul 2007 13:44:34 -, ddtm <[EMAIL PROTECTED]> wrote:
>On 3, 16:01, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
> [snip]
>
>Thank you very much! It's a very useful information. One more
>question: can I cancel the DelayedCall using its ID
9>), you'll be able to
convert any code you write for Python 2.x into Python 3.x code easily.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 03 Jul 2007 15:51:30 -, ddtm <[EMAIL PROTECTED]> wrote:
>On 3, 17:55, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
>> On Tue, 03 Jul 2007 13:44:34 -, ddtm <[EMAIL PROTECTED]> wrote:
>> >On 3, 16:01, Jean-Paul Calderone <[EMAIL PROT
On Tue, 03 Jul 2007 08:54:25 -0700, Samuel <[EMAIL PROTECTED]> wrote:
>On Jul 3, 3:03 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
>> EPIPE results when writing to a socket for which writing has been shutdown.
>> This most commonly occurs when the socket has
X records
are simple and it's not much work to pick the right host once you can do
the MX lookups.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ring), that python will dynamically add that key/value pair?
This gets much easier if you change your structure around a bit:
d = {}
d["cat", "paw"] = "some string"
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 08 Jul 2007 18:21:41 -, mshiltonj <[EMAIL PROTECTED]> wrote:
>I'm trying to find the preferred python idiom for access arbitrary
>fields of objects at run time.
>
It's not an idiom, it's a built-in function: getattr.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 09 Jul 2007 13:57:02 +0100, Will McGugan <[EMAIL PROTECTED]> wrote:
>Hi,
>
>Is there a canonical way of storing per-thread data in Python?
>
See threading.local:
http://python.org/doc/lib/module-threading.html
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
> self.msg('www', msg)
>This code doesn't work. But if try to send private message back to
>user:
>if channel == self.nickname:
> self.msg(user, msg)
>everything works fine. I really don't know what to do.
>
self.msg('www', msg) will send msg to the
ngle thread. If it is the case, then you
might want to keep around a thread pool (or process pool, or cluster)
and push the filtering work to it, reserving the IO thread strictly for
IO. This is still a win, since you end up with a constant number of
processes vying for CPU time (and you can tune this to an ideal value
given your available hardware), rather than one per connection. This
translates directly into reduced context switch overhead.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
gt;self._myvariable
This is the convention for private attributes.
>self.__myvariable
This causes the name to be mangled in an inconvenient way by the runtime. You
probably /don't/ want to name your variables like this, since the consequence
is primarily that the result is harder to use.
Jean
> File "/usr/lib/python2.5/pickle.py", line 874, in marker
>while stack[k] is not mark: k = k-1
>IndexError: list index out of range
>
>Hopefully I'm doing something obviously wrong, but if anyone can help based
>on that description or if you need to see the source, p
x27;testIt'); t.run()
>
>nothing happens.
I use `trial -b ', which automatically enables a bunch of nice
debugging functionality. ;) However, you can try this, if you're not
interested in using a highly featureful test runner:
try:
unittest.main()
except:
import pdb
pdb.pm()
This will "post-mortem" the exception, a commonly useful debugging
technique.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
.AF_INET, socket.SOCK_DGRAM)
sock.bind((host,0))
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
You shouldn't need to mess with anything beyond that.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ributed with Twisted:
http://twistedmatrix.com/trac/wiki/Downloads
I don't use unittest directly very much. I'm only slightly surprised that
it is doing something which breaks post-morteming. If you want, you could
probably fix it (probably something related to how it handles excep
l.fcntl(s.fileno(), fcntl.F_SETFD, old | fcntl.FD_CLOEXEC)
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
twork)
>
>or, better without a new "as" keyword:
>
>my_received_dict=cpickle.loads(data_from_network,type=dict)
>
>Is this at all feasible?
No. You could write a replacement for pickle, though. Oh, wait...
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 20 Jul 2007 08:15:39 -0500, alf <[EMAIL PROTECTED]> wrote:
>Jean-Paul Calderone wrote:
>
>>
>> You can avoid this, if you like. Set FD_CLOEXEC on the socket after you
>> open it, before you call os.system:
>>
>> old = fcntl.fcntl(s.fileno(
m which uses strings longer
than one byte must have a framing protocol to be reliable. So, this isn't
really specific to pickle. Basically, all protocols have to address this.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
3].
b.sort() returns None. The sort method of the list type performs
an in-place sort and always returns None. With that in mind, the
rest of your code snippets might make more sense.
I'll leave it to you to figure out how to jam everything into one
line (or, more realistically, another
nt to use select in the first place).
Or avoid the low-level networking entirely and use a high-level HTTP library
that takes care of these details for you.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
o
>extract the sandbox name, connect to the appropriate unix server socket,
>and then bidirectionally pipe bytes back and forth. But it has to do
>this for multiple connections simultaneously, which is why I need select.
Twisted does this out of the box, for what it's worth.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
11,12,12,...,25 assuming that 1 << k means "1 shift
>left by k" which is the same as multiplying with k.
No.
http://python.org/doc/ref/shifting.html
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
outfix closure operator, []:
>>> def account(s):
... b = [s]
... def add(a):
... b[0] += a
... def balance():
... return b[0]
... return add, balance
...
>>> add, balance = account(100)
>>> add(5)
>>> balance()
105
>>>
;)
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
lways rounded towards minus infinity: 1/2 is 0, (-1)/2
is -1, 1/(-2) is -1, and (-1)/(-2) is 0. Note that the result is a long
integer if either operand is a long integer, regardless of the numeric
value.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
>>> f = file('test-newlines-file')
>>> f.read()
'\xff\xfe\r\x00\n\x00'
>>>
And how it differs from your example. Are you sure you're examining
the resulting output properly?
By the way, "\r\0\n\0" isn't a "unicode line ending", it's just the UTF-16
encoding of "\r\n".
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
27;%s')" % (name,))
if I enter my name to be "'; DELETE FROM users;", then you are
probably going to be slightly unhappy. However, if you insert
rows into your database like this:
cursor.execute("INSERT INTO users (name) VALUES (%s)", (name,))
then I will simply e
801 - 900 of 1970 matches
Mail list logo