Re: Excel module for Python

2005-01-18 Thread jean-paul
to format it automatically you can either define a VBA macro or use python com. Cheers, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Async IO Server with Blocking DB

2012-04-04 Thread Jean-Paul Calderone
prise.adbapi, which wraps the module in an asynchronous API (implemented using a thread pool). Since the calls all happen in separate threads, it doesn't matter that they block. If you're not talking about a SQL database or a DB-API module, maybe be more specific about the kind o

Re: How good is security via hashing

2011-06-07 Thread Jean-Paul Calderone
10 bytes enough to thwart your attackers? Hard to say, what does an attack look like? If you want the full 16 bytes of unpredictability, why don't you just read 16 bytes from /dev/urandom and forget about all the other stuff? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How good is security via hashing

2011-06-07 Thread Jean-Paul Calderone
for > each number. > > Uuid apparently uses machine internals etc etc to try and produce randomness, > but urandom and similar can block so are probably not entirely suitable. /dev/urandom does not block, that's the point of it as compared to / dev/random. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: GIL in alternative implementations

2011-06-07 Thread Jean-Paul Calderone
e iteration to the next,   > so a complete name lookup is required at each iteration. This is very   > useful sometimes, but affects performance a lot. > And even the original example, with only + and * can have side- effects. Who knows how a defines __add__? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Secure ssl connection with wrap_socket

2011-07-05 Thread Jean-Paul Calderone
ty certificates". `wrap_socket` accepts a `ca_certs` argument. See http://docs.python.org/library/ssl.html#ssl-certificates for details about that argument. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Secure ssl connection with wrap_socket

2011-07-06 Thread Jean-Paul Calderone
On Jul 6, 4:44 am, AndDM wrote: > On Jul 5, 4:08 pm, Jean-Paul Calderone > wrote: > > > > > On Jul 5, 4:52 am, Andrea Di Mario wrote: > > > > Hi, I'm a new python user and I'm writing a small web service with ssl. > > > I want us

Re: Howto Deferred

2011-07-14 Thread Jean-Paul Calderone
not sure what the listDeferred is there for. Deferreds are a good abstraction for "do one thing and then tell me what the result was". You have a different sort of thing here, where there isn't much of a result (sending to tcp probably always works until you lose your connection). A method call works well for that. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking against NULL will be eliminated?

2011-03-03 Thread Jean-Paul Calderone
d behavior. > C and C++ have standards, and the standards describe what they don't define. Python has implementations. The defined behavior is whatever the implementation does. Until someone changes it to do something else. It's not much of a comparison. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions about GIL and web services from a n00b

2011-04-16 Thread Jean-Paul Calderone
an CPU bound > > Threads are also useful for user interaction (i.e. GUI apps).   > I suppose that's why most GUI toolkits use a multithreaded model. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalent code to the bool() built-in function

2011-04-19 Thread Jean-Paul Calderone
quot;Exactly one of a, b, c or d must be true.") > > I guess I never thought about it, but there isn't an 'xor' operator to > go along with 'or' and 'and'.  Must not be something I need very often. > You also can't evaluate xor without ev

Re: Pickling over a socket

2011-04-19 Thread Jean-Paul Calderone
his. Your server accepts arbitrary code from clients and executes it. It is completely insecure. Do not use pickle and sockets together. Notice the large red box at the top of . Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't this asyncore.dispatcher.handle_read() get called?

2011-04-20 Thread Jean-Paul Calderone
mport TestCase from twisted.test.proto_helpers import StringTransport from yourapp import Handler # Or a better name class HandlerTests(TestCase): def test_someMessage(self): """ When the "X" message is received, the "Y" response is sent back. """ transport = StringTransport() protocol = Handler() protocol.makeConnection(transport) protocol.dataReceived("X") self.assertEqual(transport.value(), "Y") Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: When is PEP necessary?

2011-04-23 Thread Jean-Paul Calderone
ese PEPs to provide compliant packages. > While its not that important for pure-python modules, anything tied to > C-API better be documented, or it becomes a nightmare to keep > non-CPython version having identical interface. > Unit tests actually serve this purpose much better than do PE

Re: sockets: bind to external interface

2011-04-25 Thread Jean-Paul Calderone
>> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) >>> s.connect(('1.2.3.4', 1234)) >>> s.getsockname() ('192.168.1.148', 47679) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: connect SIGINT to custom interrupt handler

2011-05-18 Thread Jean-Paul Calderone
m the messages in this thread if you managed to get that approach working. The most commonly encountered problem with this approach is that it means that any blocking (eg I/O) operation in progress won't be interrupted and you'll have to wait for it to complete normally. In this case, it soun

Re: Sanitizing filename strings across platforms

2011-05-31 Thread Jean-Paul Calderone
results = "_" + results >     return results > > but if somebody already has war-hardened code they'd be willing > to share, I'd appreciate any thoughts. > There's http://pypi.python.org/pypi/filepath/0.1 (taken from twisted.python.filepath). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

[ANN] txaws 0.5.0

2017-12-27 Thread Jean-Paul Calderone
anks to everyone who contributed and to Least Authority TFA GmbH <https://leastauthority.com/> for sponsoring my work on this release. Jean-Paul -- https://mail.python.org/mailman/listinfo/python-list

Announcing txAWS 0.2.3.1

2017-01-09 Thread Jean-Paul Calderone
nd fix this issue and to publish this new release. Jean-Paul -- https://mail.python.org/mailman/listinfo/python-list

[ANN] txkube 0.3.0

2018-08-08 Thread Jean-Paul Calderone
thon.org/pypi> You can contribute to its development on GitHub <https://github.com/LeastAuthority/txkube>. Thanks to Least Authority TFA GmbH <https://leastauthority.com/> for sponsoring this development and to Craig Rodrigues for his efforts on Python 3 porting work. Jean-Paul

Tahoe-LAFS on Python 3 - Call for Porters

2019-09-24 Thread Jean-Paul Calderone
u have, as well as details of your availability and any related work you have done previously (GitHub, LinkedIn links, etc). If you would like to find out more about this opportunity, please contact us at jessielisbetfrance at gmail (dot) com or on IRC in #tahoe-lafs on Freenode. J

Re: Pickle to source code

2005-10-26 Thread Jean-Paul Calderone
On 26 Oct 2005 06:15:35 -0700, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> I want to convert from pickle format to python source code. That is, >> given an existing pickle, I want to produce a textual representation >> which, when evaluated, yields the original object (as if I had >> unpickled

Re: Help: Quick way to test if value lies within a list of lists of ranges?

2005-10-27 Thread Jean-Paul Calderone
at this is actually a premature optimization. I bet there are much more interesting problems to be solved in this project, ones that you could work on and test, even while doing something as unbelievable slow as looping over 100 or so objects. ;) You can always optimize later, after you've

Re: db.DB_CREATE|db.DB_INIT_MPOOL|db.DB_THREAD|db.DB_INIT_CDB

2005-10-27 Thread Jean-Paul Calderone
On Fri, 28 Oct 2005 00:17:54 +0800, "Neville C. Dempsey" <[EMAIL PROTECTED]> wrote: >Why does this python program fail to read record "600"? > >#!/usr/bin/env python >import bsddb # twiceopen.py > >key="600" >btf=bsddb.db.DB_INIT_THREAD > >list1=bsddb.btopen("twiceopen.tbl",btflags=btf) >l

Re: lambda functions within list comprehensions

2005-10-29 Thread Jean-Paul Calderone
390097 http://article.gmane.org/gmane.comp.python.general/389011 http://article.gmane.org/gmane.comp.python.general/334625 I could go on for a while longer, but hopefully some of the linked material will answer your question. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: socket receive file does not match sent file

2005-11-06 Thread Jean-Paul Calderone
whether the connection was dropped because the file was fully transferred or because of some transient network problem or other error. One solution to this is to prefix the file's contents with its length. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: RAW_INPUT

2005-11-07 Thread Jean-Paul Calderone
es there? Josh >> You may pass, Josh >> >> I'm assuming s=Josh...but that is not included in the statement at all >> I don't know how you put "Josh" in or how you got it to finish running >> w/o hitting enter after "Who goes there?" >> >> What am I doing wrong? Did you try typing "Josh" and then enter? Or any other name, for that matter... Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python for writing models: How to run models in restricted python mode?

2005-11-07 Thread Jean-Paul Calderone
g system's capabilities to limit resource access and usage on a per-process. That is, run each piece of submitted code in a separate, unprivileged process, with the appropriate limits in place. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite3 decode error

2005-11-08 Thread Jean-Paul Calderone
s.py>). By only encoding and decoding at the border between your application and the outside world, and the border between your application and the data, you will eliminate the possibility for a class of bugs where encodings are forgotten, or encoded strings are accidentally combined with unicode strings. Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Goto XY

2005-11-08 Thread Jean-Paul Calderone
x27;t think it's maintained anymore. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Storing empties

2005-11-08 Thread Jean-Paul Calderone
ole as a sentinel, obviously. This is a reasonable trick, though: class sentinel: pass Now sentinel pickles and unpickles in a manner which agrees with the above pattern without any extra works. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Goto XY

2005-11-08 Thread Jean-Paul Calderone
rward. I'll probably do it myself when I have > the time or the motivation. > Like this? http://cvs.twistedmatrix.com/cvs/trunk/twisted/conch/insults/insults.py?view=markup&rev=14863 Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Lie Hetland book: Beginning Python..

2005-11-09 Thread Jean-Paul Calderone
gt; File "", line 1, in ? >AttributeError: 'module' object has no attribute 'paramstyle' > >>> The DB-API2ness is at pysqlite2.dbapi2: >>> from pysqlite2 import dbapi2 >>> dbapi2.paramstyle 'qmark' >>> dbapi2.threadsafety 1 >>> etc. :) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: web interface

2005-11-09 Thread Jean-Paul Calderone
ags.meta(**{"http-equiv": "refresh", "content": "0;calc"})]]) def child_calc(self, ctx): return LongTaskPage(ICalculator, Adder()) application = service.Application("Push Mechanism, like back in '97") webserver = internet.TCPServer(8080, appserver.NevowSite(Root())) webserver.setServiceParent(application) # eof Right? But maybe you can explain why, for those of us who aren't enlightened. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python obfuscation

2005-11-09 Thread Jean-Paul Calderone
o the end user. What's to stop someone from publishing the decrypted code online for anyone to download? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: web interface

2005-11-10 Thread Jean-Paul Calderone
t'll probably work with IE in an upcoming release, though. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamically Update Class Definitions?

2005-11-11 Thread Jean-Paul Calderone
able failures as to make it cost more time than it saves. You really want to stop the rest of the program, then update things, then let everything get going again. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: XUL behavior in Python via XPCOM, Mozilla

2005-11-12 Thread Jean-Paul Calderone
it again. Anyway, I was hoping someone >on c.l.p / python.org would have a reliable reference on >this. I'm not sure which claim you read, but perhaps it was in reference to PyXPCOM? <http://aspn.activestate.com/ASPN/Downloads/Komodo/PyXPCOM/> I'm not quite sure if you are

Re: is parameter an iterable?

2005-11-15 Thread Jean-Paul Calderone
catch it during their testing >:) If you return an error code instead, they are just as likely to pass in bad data, and even *more* likely to not see that an error has occurred, causing their programs to be incorrect. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating (rather) generic plugin framework?

2005-11-16 Thread Jean-Paul Calderone
. > >Inspired by http://www.python.org/pycon/2005/papers/7/pyconHooking.html You may want to look at a few existing Python plugin systems. To get you started, here's a link to the Twisted plugin system documentation: <http://twistedmatrix.com/users/warner/doc-latest/core/howto/plugin.html>

Re: General question about Python design goals

2005-11-27 Thread Jean-Paul Calderone
suspect you don't. If you really did, you may want to pick up one of those platitude-filled XP books and give it a careful read. You may find there's more there than you were previously aware. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there anything that pickle + copy_reg cannot serialize?

2005-12-08 Thread Jean-Paul Calderone
kling will fail. You can raise this limit, to a point, with sys.setrecursionlimit(). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there anything that pickle + copy_reg cannot serialize?

2005-12-08 Thread Jean-Paul Calderone
lp. The above example basically teaches the copy_reg module how to give the pickle module the help it needs for code objects. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Validating an email address

2005-12-09 Thread Jean-Paul Calderone
to the email >package, if a satisfactory one can be written; i would definitely support >their doing that. The top part of <http://divmod.org/users/viewcvs.twistd/branches/exarkun/smtp-2418/quotient/proto/smtp.py?rev=7661&view=markup> contains a parser that, IIRC, is basica

Re: Dectecting dir changes

2005-12-09 Thread Jean-Paul Calderone
mpletion() return result def write(self, bytes): return self.wrappedReceiver.write(bytes) Hook it up to a Realm and a Portal and override uploadCompleted to taste and you've got an FTP server that should do you (granted, it's a little long - some of this code

Re: Overloading

2005-12-09 Thread Jean-Paul Calderone
, complex2): res = Complex(self.real + complex2.real, self.imag + complex2.imag) return res Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Dectecting dir changes

2005-12-09 Thread Jean-Paul Calderone
ause I thought you were tied to FTP. If you actually have security concerns, you might want to use SFTP instead (which Twisted also supports, but to which the code I sent is only partly applicable). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Managing import statements

2005-12-10 Thread Jean-Paul Calderone
The *only* things it tells me about are modules that are imported but never used and names that are used but not defined. It's false positive rate is something like 1 in 10,000. > >Is there a tool that simply scans each module and updates the import >statements, subject to my app

Re: Managing import statements

2005-12-10 Thread Jean-Paul Calderone
On Sat, 10 Dec 2005 13:40:12 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: >> On Sat, 10 Dec 2005 02:21:39 -0700, Shane Hathaway >> <[EMAIL PROTECTED]> wrote: >>> How about PyLint / PyChecker? Can I configure one of them to te

Re: Managing import statements

2005-12-10 Thread Jean-Paul Calderone
On Sat, 10 Dec 2005 11:54:47 -0700, Shane Hathaway <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: >> On Sat, 10 Dec 2005 02:21:39 -0700, Shane Hathaway <[EMAIL PROTECTED]> wrote: >>>How about PyLint / PyChecker? Can I configure one of them to tell me >>

Re: Question about tuple lengths

2005-12-14 Thread Jean-Paul Calderone
uot;,) >>> type(t2) >>> t3 = "blah", >>> type(t3) >>> It's the comma that makes it a tuple. The parenthesis are only required in cases where the expression might mean something else without them. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading in python

2005-12-14 Thread Jean-Paul Calderone
de that mostly calls >into C libraries that release the GIL. For example, a threaded spider >scales nicely on SMP. Yes. Nearly as well as a single-threaded spider ;) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Wed Development - Dynamically Generated News Index

2005-12-17 Thread Jean-Paul Calderone
tion("News Site") webserver = appserver.NevowSite(NewsIndex(cp)) internet.TCPServer(80, webserver).setServiceParent(application) # Run with twistd -noy For more information about Nevow, checkout the Wiki - <http://divmod.org/trac/wiki/DivmodNevow> - or the mailing list - <http://twist

Re: Wed Development - Dynamically Generated News Index

2005-12-18 Thread Jean-Paul Calderone
On 18 Dec 2005 12:27:55 -0800, [EMAIL PROTECTED] wrote: >Hi Jean-Paul, > >I am a bit lost in you code. Is it possible for you to step through >it? For in depth-assistance, it would probably be best to continue on [EMAIL PROTECTED] You might also want to check out some of the lin

Re: Which Python web framework is most like Ruby on Rails?

2005-12-22 Thread Jean-Paul Calderone
7;t a web framework, though it includes an HTTP server. >Webware : Python licence >Zope : ZPL (Zope Public Licence) > >There doesn't seem to be an obvious choice, but the GPL isn't used much >here > Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IMAP4 Memory Error

2005-12-23 Thread Jean-Paul Calderone
. You might also address it as a deployment issue, and run fewer programs on the host in question, or reboot it more frequently. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: XPath-like filtering for ElementTree

2005-12-26 Thread Jean-Paul Calderone
ple pieces, pass parts of it around as real, live objects with introspectable APIs, allow for mutation of portions of the query, re-arrange it, etc. All this is possible with strings too, just way harder :) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: python coding contest

2005-12-27 Thread Jean-Paul Calderone
seg(x):return urllib2.urlopen('http://7seg.com/'+x).read() >> >And another one from me as well. > >class a: > def __eq__(s,o):return 1 >seven_seg=lambda i:a() > This is shorter as "__eq__=lambda s,o:1". But I can't find the first post in this thread... What are you guys talking about? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple question on Parameters...

2005-12-28 Thread Jean-Paul Calderone
rue, outlineColor=(1, 1, 1), fillColor=(0, 0, 0.25)): ... Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a refrence issue?

2005-12-28 Thread Jean-Paul Calderone
or like this: import copy tmp = copy.copy(myList) This is as opposed to a deep copy, which is like this: import copy tmp = copy.deepcopy(myList) What "tmp = myList" does is to create a new *reference* to the very same list object. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Is len() restricted to (positive) 32-bit values?

2005-12-29 Thread Jean-Paul Calderone
bit processor, and Python ints appear to be 64-bit as well, so even >if len() only works with ints, it should still be able to handle 64-bit >values. Conspicuous timing: <http://mail.python.org/pipermail/python-dev/2005-December/059266.html> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python as a Server vs Running Under Apache

2006-01-01 Thread Jean-Paul Calderone
seHTTPServer in the standard library will address /this/ particular issue (there are lots of other solutions, too, not just these four). Some of them may address other issues better or worse than others. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading for a newbie

2006-01-05 Thread Jean-Paul Calderone
he list calling join on each one. join will block until the thread's function returns. > > # How do I print "order" after all the threads are complete? > print "\nThreads were processed in the following order:" > for i, person in enumerate(order): print "%d. %s" % (i+1,person) > >if __name__ == "__main__": > main() > Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Spelling mistakes!

2006-01-06 Thread Jean-Paul Calderone
ne 10, in testSomeName self.assertEquals(x.someName, "bye") twisted.trial.unittest.FailTest: 'hello' != 'bye' - Ran 1 tests in 0.278s FAILED (failures=1) [EMAIL PROTECTED]:~$ Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: question about mutex.py

2006-01-06 Thread Jean-Paul Calderone
d -- hence the funny interface for lock, where a function is called once the lock is aquired. If you are looking for a mutex suitable for multithreaded use, see the threading module. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling foreign functions from Python? ctypes?

2006-01-06 Thread Jean-Paul Calderone
its" or "license" for more information. >>> import sys >>> sys.setrecursionlimit(10) __main__:1: DeprecationWarning: integer argument expected, got float >>> (lambda f: f(f))(lambda f: f(f)) Segmentation fault [EMAIL PROTECTED]:~$ I could probably dig up a few more, if you want. So what's ctypes on top of this? Jean-Paul > >Neil >-- >http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list

Re: Failing unittest Test cases

2006-01-10 Thread Jean-Paul Calderone
It's important to keep the two kinds of tests separate. Integration tests are great for telling you that something has gone wrong, but if you get rid of all your unit tests in the process of writing integration tests, you will have a more difficult time determining *what* has gone wrong. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I test if an argument is a sequence or a scalar?

2006-01-10 Thread Jean-Paul Calderone
r, it won't work for anything: >>> iter(5) Traceback (most recent call last): File "", line 1, in ? TypeError: iteration over non-sequence This is "duck typing" in action. Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Marshal Obj is String or Binary?

2006-01-14 Thread Jean-Paul Calderone
#x27;) will do the same job without the security >hole: Using marshal at all introduces a similar security hole, so security is not an argument against repr()/eval() in this context. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: proposal: another file iterator

2006-01-15 Thread Jean-Paul Calderone
re a multiple of the filesystem block size, would it guarantee reads on block-boundaries (where possible)? * How would it handle EOF? Would it stop iterating immediately after the first short read or would it wait for an empty return? * What would the buffering behavior be? Could one interlea

Re: Space left on device

2006-01-16 Thread Jean-Paul Calderone
e on a platform with statvfs(2): >>> import os >>> s = os.statvfs('/') >>> s.f_bavail * s.f_bsize 59866619904L >>> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: magical expanding hash

2006-01-17 Thread Jean-Paul Calderone
+ a else: a = _x else: a = b + a else: if hasattr(a, '__iadd__'): _x = a.__iadd__(b) if _x is NotImplemented: a = b + a else: a = _x else: a = b + a Roug

Re: Simultaneous connections

2006-01-20 Thread Jean-Paul Calderone
On 20 Jan 2006 06:01:15 -0800, datbenik <[EMAIL PROTECTED]> wrote: >How can i write a program that supports simultaneous multipart >download. So i want to open multiple connections to download one file. >Is this possible. If so, how? http://twistedmatrix.com/ > >-- >http://mail.python.org/mailman

Re: Warning when new attributes are added to classes at run time

2006-07-19 Thread Jean-Paul Calderone
s, they will fail and you will know you need to fix your code. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How to force a thread to stop

2006-07-24 Thread Jean-Paul Calderone
ple: thread receives a >message, stops everything, and processes the message. > And what happens if the thread was halfway through a malloc call and the data structures used to manage the state of the heap are in an inconsistent state when the interrupt occurs? This has been discussed m

Re: How to force a thread to stop

2006-07-24 Thread Jean-Paul Calderone
On Mon, 24 Jul 2006 13:51:07 -0700, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: >> On Mon, 24 Jul 2006 11:22:49 -0700, "Carl J. Van Arsdall" <[EMAIL >> PROTECTED]> wrote: >> >>> Steve Ho

Re: micro authoritative dns server

2006-07-24 Thread Jean-Paul Calderone
esolv.conf then the browsers only >recognize the hosts we want Twisted includes a DNS server which is trivially configurable to perform this task. Take a look. http://twistedmatrix.com/ http://twistedmatrix.com/projects/names/documentation/howto/names.html Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Q: Class Privacy (or lack of)

2006-07-24 Thread Jean-Paul Calderone
the solution is simple: don't do things like this ;) It is allowed at all because, to the runtime, "x.someattr = someval" is no different from "self.someattr = someval". The fact that a different name is bound to a particular object doesn't matter. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Stack trace in C

2006-07-25 Thread Jean-Paul Calderone
ack >a backtrace in case of errors in the python code. I think you'd have more luck with the traceback module, which has such methods as format_exception and print_tb. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How to force a thread to stop

2006-07-25 Thread Jean-Paul Calderone
ising an exception in your own thread is pretty trivial. SIGALRM does no good whatsoever here. :) Besides, CPython will only raise exceptions between opcodes. If a misbehaving thread hangs inside an opcode, you'll never see the exception from SIGALRM. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python stack trace on blocked running script.

2006-07-25 Thread Jean-Paul Calderone
.gmane.org/gmane.comp.python.devel/82129 Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Need a compelling argument to use Django instead of Rails

2006-07-26 Thread Jean-Paul Calderone
;>> list.append = lambda self, value: 'hello, world' >>>> x = [] >>>> x.append(10) 'hello, world' >>>> x [] >>>> As alternate implementations become more widely used, it will be important to nail down ex

Re: How to force a thread to stop

2006-07-27 Thread Jean-Paul Calderone
combined with the fact that in Python you /still/ cannot handle a signal until the interpreter is ready to let you do so (a fact that seems to have been ignored in this thread repeatedly), signals end up not being a solution to this problem. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How to force a thread to stop

2006-07-27 Thread Jean-Paul Calderone
try: return threading.Thread.run(self) except Exception, e: print 'Exiting', e def main(): threads = [] for f in timeSleep, childSleep, catchException: t = KillableThread(target=f) t.start() threads.a

Re: Info on continuations?

2006-08-08 Thread Jean-Paul Calderone
p but lead to misunderstandings. >to *really* suspend the stack at a given time and do a bunch of crazy >stuff, but doesn't currently support 'full continuations'. > Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: do people really complain about significant whitespace?

2006-08-09 Thread Jean-Paul Calderone
l don't think meaningful indentation is good. If your example were actually valid (which it isn't), all it would demonstrate is that Python should be even stricter about indentation, since it would have meant that there is still some whitespace which has no meaning and therefore can be adjusted in meaingless ways by each programmer, resulting in unreadable junk. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: start a multi-sockets server (a socket/per thread) with different ports but same host

2006-08-12 Thread Jean-Paul Calderone
k when all the other # Deferreds in this list have been called back. d = defer.DeferredList(completionDeferreds) # And tell it to stop the reactor when it fires d.addCallback(lambda result: allConnectionsLost()) # Start the reactor so things can start happening reactor.ru

Re: self=pickle.load(file)? (Object loads itself)

2006-08-12 Thread Jean-Paul Calderone
thod(fromPickleFile) You can then use this like so: inst = Obj.fromPickleFile('obj.dat') Jean-Paul > >Anton >-- >http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list

Re: start a multi-sockets server (a socket/per thread) with different ports but same host

2006-08-12 Thread Jean-Paul Calderone
On 12 Aug 2006 10:44:29 -0700, zxo102 <[EMAIL PROTECTED]> wrote: >Jean-Paul, >Thanks a lot. The code is working. The python twisted is new to me too. >Here are my three more questions: >1. Since the code need to be started in a wxpyhon GUI (either by >clicking a button or up

Re: start a multi-sockets server (a socket/per thread) with different ports but same host

2006-08-13 Thread Jean-Paul Calderone
On 12 Aug 2006 21:59:20 -0700, zxo102 <[EMAIL PROTECTED]> wrote: >Jean-Paul, >I just start to learn Twisted. Here is my simple case: I can find >the data sent by clients in dataReceived but I don't know which >client/which port the data is from. After I know where the

Re: How to tell machines endianism.

2006-08-15 Thread Jean-Paul Calderone
On 15 Aug 2006 10:06:02 -0700, KraftDiner <[EMAIL PROTECTED]> wrote: >How can you tell if the host processor is a big or little endian >machine? > sys.byteorder Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Anyone have a link handy to an RFC 821 compliant email address regex for Python?

2006-08-16 Thread Jean-Paul Calderone
nd from google searches are not really as >> robust as I need them to be. > >Would email.Utils.parseaddr() fit the bill? > >http://docs.python.org/lib/module-email.Utils.html#l2h-3944 > This is for RFC 2822 addresses. http://divmod.org/trac/browser/sandbox/exarkun/smtp.

Re: socket client server... simple example... not working...

2006-10-04 Thread Jean-Paul Calderone
buf = '' def dataReceived(self, bytes): self.buf += bytes exit = self.buf.find('exit') if exit != -1: self.transport.write(self.buf[:exit]) self.buf = self.buf[exit + 4:] reactor.stop() else: self.transport.write(self.buf) self.buf = '' f = protocol.ServerFactory() f.protocol = Server reactor.listenTCP('192.168.1.101', 8080, f) reactor.run() Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: socket client server... simple example... not working...

2006-10-05 Thread Jean-Paul Calderone
On 5 Oct 2006 07:01:50 -0700, SpreadTooThin <[EMAIL PROTECTED]> wrote: > [snip] > >Jean-Paul many thanks for this and your effort. >but why is it every time I try to do something with 'stock' python I >need another package? Maybe you are trying to do things that a

Re: Restoring override of urllib.URLopener.open_https

2006-10-05 Thread Jean-Paul Calderone
and AFAIK, the original urllib >code is irreversibly overwritten. Am I right? Mostly. However, Try importing urllib first, grabbing the open_https function, then importing M2Crypto, then reversing what M2Crypto did by putting the original open_https function back onto URLopener. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 342 misunderstanding

2006-10-08 Thread Jean-Paul Calderone
opIteration: ... break ... 0 2 4 6 8 10 12 14 16 18 > >Now, I was expecting that to be 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20. > >What am I missing here? Your code was calling next and send, when it should have only been calling send. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: can regular ol' python do a php include?

2006-10-10 Thread Jean-Paul Calderone
7;header.html').read() > >Not quite as elegant as include('header.html'), but it seems like it >would work. def include(filename): print open(filename).read() include('header.html') Behold, the power of a general purpose programming language. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: trying to twist my head around twisted (and python)

2006-10-11 Thread Jean-Paul Calderone
uccessful result. If all of your processing is synchronous, then you simply need to return twisted.internet.defer.succeed(None) at the end of the function. If you have asynchronous processing to do (it does not appear as though you do), you will need to return a Deferred which only fires once that processing has been completed. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting existing module/objects to threads

2006-10-19 Thread Jean-Paul Calderone
check the current time against the top element's time. You could also use Twisted, which provides time-based primitives in addition to supporting network multiplexing without threads. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: trying to twist my head around twisted (and python)

2006-10-20 Thread Jean-Paul Calderone
On Fri, 13 Oct 2006 18:44:35 +0200, Jan Bakuwel <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: > >> The return value of eomReceived is used to determine whether to signal to >> the SMTP client whether the message has been accepted. Regardless of your >>

  1   2   3   4   5   6   7   >