Re: xml parsing escape characters

2005-01-20 Thread Irmen de Jong
Kent Johnson wrote: [...] This is an XML document containing a single tag, , whose content is text containing entity-escaped XML. This is *not* an XML document containing tags , , , etc. All the behaviour you are seeing is a consequence of this. You need to unescape the contents of the tag to

Re: xml parsing escape characters

2005-01-20 Thread Irmen de Jong
Martin v. Löwis wrote: Irmen de Jong wrote: The unescaping is usually done for you by the xml parser that you use. Usually, but not in this case. If you have a text that looks like XML, and you want to put it into an XML element, the XML file uses < and >. The XML parser unescapes that as

Re: What YAML engine do you use?

2005-01-20 Thread Irmen de Jong
Istvan Albert wrote: XML with elementtree is what makes me never have think about XML again. +1 QOTW -Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: make install with python

2005-01-23 Thread Christopher De Vries
On Sat, Jan 22, 2005 at 01:54:17AM +0100, Uwe Mayer wrote: > Any suggestions how I handle uninstallation? This was provided by automake > rather mechanically. I didn't find a section on that in the distutils > documentation... :( I've been using distutils for a couple of projects I've written for

ANN: Frog 1.3 released (python 'blog' application)

2005-01-30 Thread Irmen de Jong
e: http://snakelets.sourceforge.net/frog/ It's 60Kb if you already have Snakelets, otherwise 122Kb. Frog 1.3 uses the same storage format as 1.2 so no conversion is required. If you encounter bugs or problems, or want to give some feedback, please let me know. Enjoy, --Irmen de Jong. PS I'm running

Re: how to find number of processors in python

2005-01-31 Thread Christopher De Vries
"/usr/sbin/psrinfo -p" will print the number of physical processors on the system, though it does not indocate if they are on- or off-line. You could also write an extension which gets processor information using the sys/processor library. Example code is available in the "p_online" man page. Chr

Re: Microsoft Visual C++ and pyton

2005-01-31 Thread Christopher De Vries
On Sun, Jan 30, 2005 at 03:12:06PM -0800, mike wrote: > I am new with python. Is it possible to have an MFC application and > develop some module using python? what are the steps in doing this? can > anybody give me a url or some documentation for this.. thanks.. It is possible to embed python in

python ScriptControl error in Excel while running fine in python

2005-02-01 Thread Sebastien de Menten
I am trying to use ScriptControl under Excel (Windows XP) with the code: Global sc As New MSScriptControl.ScriptControl Public Function os_getcwd() sc.Language = "python" sc.ExecuteStatement ("import os") os_getcwd = sc.Eval("os.getcwd()") End Function When setting the language to py

Re: Microsoft Visual C++ and pyton

2005-02-01 Thread Christopher De Vries
On Mon, Jan 31, 2005 at 02:42:11PM -0800, mike wrote: > I was also advised to build the python core (pythoncore.vcproj) with my > C++ program. By that way I would not have to load the python core > anymore during runtime. Is this a good approach? > I am currently using VC++ 7 and python 2.4. I'm n

Re: hotspot profiler experience and accuracy?

2005-02-02 Thread Irmen de Jong
aurora wrote: But the numbers look skeptical. Hotspot claim 71.166 CPU seconds but the actual elapsed time is only 54s. When measuring elapsed time instead of CPU time the performance gain is only 13% with the profiler running and down to 10% when not using the profiler. Is there something I

Re: Python for S60 mentioned in a mainstream Finnish e-news website

2005-02-02 Thread Irmen de Jong
Ville Vainio wrote: "Thomas" == Thomas Heller <[EMAIL PROTECTED]> writes: >> (Yeah, ctypes will probably be a problem because of the way Symbian >> handles DLLs) Thomas> How *does* symbian handle DLLs? By ordinal, so the dll does not include the symbol name (in order to keep the size s

Getting a module's byte code, how?

2005-02-02 Thread Irmen de Jong
What would be the best way, if any, to obtain the bytecode for a given loaded module? I can get the source: import inspect import os src = inspect.getsource(os) but there is no ispect.getbytecode() ;-) --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a module's byte code, how?

2005-02-02 Thread Irmen de Jong
Mark Nenadov wrote: On Wed, 02 Feb 2005 23:03:17 +0100, Irmen de Jong wrote: What would be the best way, if any, to obtain the bytecode for a given loaded module? I can get the source: import inspect import os src = inspect.getsource(os) but there is no ispect.getbytecode() ;-) --Irmen The

Re: Getting a module's byte code, how?

2005-02-02 Thread Irmen de Jong
Steve Holden wrote: Having said which, if the module was loaded from a .pyc file then the bytecode is available from that - take everything but the first eight bytes and use marshal.loads() to turn it back into a code object: Yup. As I explained in the other message, this is basically what I'm do

Re: Getting a module's byte code, how?

2005-02-02 Thread Irmen de Jong
Steve Holden wrote: I'm not sure why you think the module's code would be needed once it's been executed. That assigns all necessary code blocks to the functions defined therein, so the code, once the import has been executed, is garbage (from the interpreter's rather process-centric view of thi

Re: Getting a module's byte code, how?

2005-02-02 Thread Irmen de Jong
Steve Holden wrote: But I also want the bytecode of modules that don't have a .pyc file, possibly because they have already been 'dynamically' loaded from another bytecode string ;-) Aah, right, I suspect in these cases (which *are* pretty far from the ordinary run of things) you'd sometimes be up

Re: Popularizing SimpleHTTPServer and CGIHTTPServer

2005-02-03 Thread Irmen de Jong
Jorey Bump wrote: Does anyone know how to use SimpleHTTPServer to: 1. Support virtual hosts? 2. Support SSL? I'd like to use SimpleHTTPServer to create some simple reporting utilities, but can't get past these two points. Is there a NotSoSimpleHTTPServer? Give Snakelets a try (snakelets.sf.net). I

Re: ANN: Frog 1.3 released (python 'blog' application)

2005-02-04 Thread Irmen de Jong
Jorey Bump wrote: Irmen de Jong <[EMAIL PROTECTED]> wrote in news:41fcf53b [EMAIL PROTECTED]: I've just uploaded the Frog 1.3 release. Frog is a blog (web log) system written in 100% Python. It is a web application written for Snakelets. It outputs XHTML, is fully unicode compatible,

Re: getting an object name

2005-06-22 Thread Irmen de Jong
David Bear wrote: > Let's say I have a list called, alist. If I pass alist to a function, > how can I get the name of it? > > alist = range(10) > > def afunction(list): > listName = list.__name__ (fails for a list object) > You don't, see the other reply. You didn't say why you think you n

Re: os.system(cmd) isn't working

2005-06-23 Thread Tjarko de Jong
On Thu, 23 Jun 2005 00:02:55 -0400, Gregory Piñero <[EMAIL PROTECTED]> wrote: >Hi guys, > >I'm trying to run this statement: > >os.system(r'"C:\Program Files\Mozilla Firefox\firefox.exe"' + ' >"www.blendedtechnologies.com"') > >The goal is to have firefox open to that website. > >When I type r'"C:

Re: python broadcast socket

2005-06-29 Thread Irmen de Jong
Grant Edwards wrote: > Under Linux, you need to be root to send a broadcase packet. I don't think this is true. --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: Scket connection to server

2005-07-01 Thread Irmen de Jong
Christopher Subich wrote: > Steve Horsley wrote: > >> There is a higher level socket framework called twisted that everyone >> seems to like. It may be worth looking at that too - haven't got round >> to it myself yet. > > > I wouldn't say 'like,' exactly. I've cursed it an awful lot (mostly

Re: I am a Java Programmer

2005-07-01 Thread Irmen de Jong
George Sakkis wrote: > "[EMAIL PROTECTED]" wrote: > > >>I am a java programmer and I want to learn Python Please help me. > > > Google Is Your Friend: > > http://www.razorvine.net/python/PythonForJavaProgrammers > http://www.ferg.org/projects/python_java_side-by-side.html > > George > The f

(Win32 API) callback to Python, threading hiccups

2005-07-05 Thread Francois De Serres
ll I figure out what's really happening. Could someone save my precious and already sparse sleeping time, by pointing me to what I'm missing here? WinXP SP1 Python 2.4.1 MinGW GCC 3.4.2 TIA, Francois De Serres -- http://mail.python.org/mailman/listinfo/python-list

Re: (Win32 API) callback to Python, threading hiccups

2005-07-05 Thread Francois De Serres
Christopher Subich wrote: >Francois De Serres wrote: > > >>- so, on callback, I create a new thread, after checking that the >>previous one has returned already (WaitOnSingleObject(mythread)) so we >>only have one thread involved. >> >> > >

The GIL, callbacks, and GPFs

2005-07-06 Thread Francois De Serres
Hello, I'm chasing a GPF in the interpreter when running my extension module. It's not very elaborated, but uses a system (threaded) callback, and therefore the GIL. Help would be mucho appreciated. Here's the rough picture: win32_spam.c /* code here is unit-tested OK */ typedef st

Building a function call?

2005-07-13 Thread Francois De Serres
Hiho, Having a string: "dothat" and a tuple: (x, y) 1. What's the best way to build a function call like: dothat(x,y)? Assuming dothat is def'd in the same module, 2. is: eval("dothat(x,y)", None, (('x', 100), ('y', 200))) the right way to have it executed? If dothat is def'd in another module:

**kwargs?

2005-07-13 Thread Francois De Serres
All your **kwargs are belong to us. *args is documented in the Tutorial. I reckon **kwargs represents a dictionary of arguments. But I don't quite get the semantics of **x. Undefined length tuple of undefined length tuples? Are there other practical use cases for ** (common enough please, I wis

Re: Building a function call?

2005-07-13 Thread Francois De Serres
Roland Heiber wrote: >Francois De Serres wrote: > > >>Hiho, >> >>Having a string: "dothat" >>and a tuple: (x, y) >>1. What's the best way to build a function call like: dothat(x,y)? >> >> > >Not the best (not at

Re: Building a function call?

2005-07-13 Thread Francois De Serres
Peter Hansen wrote: >Roland Heiber wrote: > > >>Not the best (not at all) but one way: >> >>def dothat(x,y): >> print "Called with:", x, y >> >>c = (1,2) >> >>locals().get("dothat")(*c) >> >> > >As you say, not the best, but in fact not really advisable under any >circumstances. locals()

Re: **kwargs?

2005-07-13 Thread Francois De Serres
Michael Hoffman wrote: >Peter Hansen wrote: > > >>Francois De Serres wrote: >> >> >> > > > >>>*args is documented in the Tutorial. I reckon **kwargs represents a >>>dictionary of arguments. But I don't quite get the semant

Re: Building a function call? (update)

2005-07-13 Thread Francois De Serres
Francois De Serres wrote: >Hiho, > >Having a string: "dothat" >and a tuple: (x, y) >1. What's the best way to build a function call like: dothat(x,y)? > >Assuming dothat is def'd in the same module, >2. is: eval("dothat(x,y)", None, ((

Re: Building a function call?

2005-07-13 Thread Francois De Serres
Steven D'Aprano wrote: >On Wed, 13 Jul 2005 06:16:54 -0700, Robert Kern wrote: > > > >>Duncan Booth wrote: >> >> >>>Francois De Serres wrote: >>> >>> >>> >>>>Having a string: "dothat"

Re: Building a function call? (update)

2005-07-13 Thread Francois De Serres
Duncan Booth wrote: >Francois De Serres wrote: > > > >>Sorry, I was unclear about the fact that the args are formals. I'm >>trying to do something like: >> >>func = "dothat" >>args = ('x','y') >>localcontext =

Re: Building a function call? (update)

2005-07-13 Thread Francois De Serres
Scott David Daniels wrote: >Francois De Serres wrote: > > >>Francois De Serres wrote: >> >> >>>Having a string: "dothat" >>>and a tuple: (x, y) >>>1. What's the best way to build a function call like: dothat(x,y)? >>

Documenting extension modules?

2005-07-15 Thread Francois De Serres
Hiho, I can't seem to find a proper way to document my extension module. Following the C API doc: static PyMethodDef ioMethods[] = { {"o_count", o_count, METH_VARARGS, "Return the count of available MIDI outputs."}, } lacks: a) module level documentation b) function parameters Also,

Re: Documenting extension modules?

2005-07-15 Thread Francois De Serres
Robert Kern wrote: >Francois De Serres wrote: > > >>Hiho, >> >>I can't seem to find a proper way to document my extension module. >>Following the C API doc: >> >>static PyMethodDef ioMethods[] = { >>{"o_count", o_c

Re: Documenting extension modules?

2005-07-15 Thread Francois De Serres
Simon Dahlbacka wrote: >Re: assigning a PyStr object to __doc__, take a look at Py_InitModule3, >which does that for you. > > > got it, thx. >Then you have the PyDoc_STRVAR macro in python.h that you might want to >use (see definition below). But as Robert already told you, you'll need >to prov

Exception in callback => GPF?

2005-07-15 Thread Francois De Serres
Hiho, When there's an unhandled exception in my extension-module's-callback-into-Python-function-object, I get a GPF and Python exits. When the exception is being handled within the callback (hence in Python), I get a very significant hiccup (1 to 5 seconds freeze). Question: is there a specif

tuple to string?

2005-07-22 Thread Francois De Serres
hiho, what's the clean way to translate the tuple (0x73, 0x70, 0x61, 0x6D) to the string 'spam'? TIA, Francois -- http://mail.python.org/mailman/listinfo/python-list

Re: tuple to string?

2005-07-24 Thread Francois De Serres
Francois De Serres wrote: >hiho, > >what's the clean way to translate the tuple (0x73, 0x70, 0x61, 0x6D) to >the string 'spam'? > >TIA, >Francois > > thanks to all! I'll pick ('%c' * len(t)) % t, for it's readability and the

Re: tuple to string?

2005-07-24 Thread Francois De Serres
Robert Kern wrote: >Francois De Serres wrote: > > > >>I'll pick ('%c' * len(t)) % t, for it's readability and the fact that >>join() is on the deprec'd list. >> >> > >''.join() is certainly not deprecated. What m

Re: client server question

2005-08-15 Thread Irmen de Jong
Robert Wierschke wrote: > John schrieb: > >> I have a simple script that runs a server where one client can connect. >> I would like to make it so that many clients can connect to one server >> on the same port. Where can I find how to do this? >> >> Thanks, >> --j >> > > use sockets. Or, if you

Re: network programming

2005-08-22 Thread Irmen de Jong
John Walton wrote: > Hello, everyone. I just began school, and they > already assigned us science fair. Since I'm in 8th > grade, I get to do demonstrations for our projects. > I'm probably going to demonstrate Python's networking > capabilities by writing a simple instant messenger > program.

Re: Windows Python 2.4: Unbuffered flag causes SyntaxError on interactive sessions?

2005-09-13 Thread Irmen de Jong
Michael Hoffman wrote: > Lonnie Princehouse wrote: > >> C:\>python -u >> Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] >> on win32 >> Type "help", "copyright", "credits" or "license" for more information. >> > print 'hello' >> >> >> File "", line 1 >> print 'hello

Re: Dictionary sorting problem

2005-09-16 Thread Irmen de Jong
JerryB wrote: > Hi, > I have a dictionary for counting ocurrences of strings in a document. > The dictionary looks like this: > > 'hello':135 > 'goodbye':30 > 'lucy':4 > 'sky':55 > 'diamonds':239843 > 'yesterday':4 > > I want to print the dictionary so I see most common words first: > > 'diamond

Re: socket.gethostbyaddr problem

2005-09-17 Thread Irmen de Jong
Mohammed Smadi wrote: > hi; > I am trying to do some very basic socket programming and i get the > following error. Any help will be appreciated: > > Code: > import socket > x = socket.gethostbyaddr("www.google.ca") > > return an error: socket.herror: (1, 'Unknown host') You're using the wrong

Re: ANN: Frog 1.3 released (python 'blog' application)

2005-02-06 Thread Irmen de Jong
future version. For now, you'll just have to login twice or hack your own centralized logon thing ;-) Have fun, --Irmen de Jong -- http://mail.python.org/mailman/listinfo/python-list

Re: New to unix/python. How to install

2005-02-07 Thread Christopher De Vries
On Sun, Feb 06, 2005 at 01:42:22PM -0800, Bobby Owens wrote: > I've muddled through the python code and figured out parts of it. I've > now installed Sun Solaris 10 on a VM ware installation successfully > and can muddle thorough the basics of the o/s. I cant figure out how > to install python. Fro

Re: python code with indention

2005-02-07 Thread Christopher De Vries
On Mon, Feb 07, 2005 at 03:43:15PM -0500, Dan Perl wrote: > > "Xah Lee" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > is it possible to write python code without any indentation? > > I read just today in a tutorial that "Python on the other hand, does not > even allow change

Choosing the right parser for parsing C headers

2005-02-08 Thread Jean de Largentaye
Hi, I need to parse a subset of C (a header file), and generate some unit tests for the functions listed in it. I thus need to parse the code, then rewrite function calls with wrong parameters. What I call "shaking the broken tree" :) I chose to make my UT-generator in Python 2.4. However, I am no

Re: Choosing the right parser for parsing C headers

2005-02-08 Thread Jean de Largentaye
GCC-XML looks like a very interesting alternative, as Python includes tools to parse XML. The mini-C compiler looks like a step in the right direction for me. I'm going to look into that. I'm not comfortable with C++ yet, and am not sure how I'd use Pyste. Thanks for the information guys, you've b

Re: Choosing the right parser for parsing C headers

2005-02-08 Thread Jean de Largentaye
That looks cool Roman, however, I'm behind a Corporate Firewall, is there any chance you could send me a cvs snapshot? John -- http://mail.python.org/mailman/listinfo/python-list

Re: Synchronizing methods of a class

2005-02-08 Thread Christopher De Vries
On Mon, Feb 07, 2005 at 11:57:02AM -0800, Keith Veleba wrote: > Background: > I'm working on a project where I have to do some serious > multithreading. I've worked up a decorator in Python 2.3.4 to implement > the lock semantics required for specific functions I want to > synchronize: I found Chr

Re: Python versus Perl ?

2005-02-08 Thread Irmen de Jong
m wrote: Fredrik Lundh wrote: if you use Python mostly to write empty loops, your programming license should be revoked. the benchmark author seems to have realized that, as can be seen from the "it's dead" paragraph at the top of the page, which makes me wonder why you posted this link... i wa

is there a safe marshaler?

2005-02-10 Thread Irmen de Jong
Pickle and marshal are not safe. They can do harmful things if fed maliciously constructed data. That is a pity, because marshal is fast. I need a fast and safe (secure) marshaler. Is xdrlib the only option? I would expect that it is fast and safe because it (the xdr spec) has been around for so lo

Re: is there a safe marshaler?

2005-02-10 Thread Irmen de Jong
Pierre Barbier de Reuille wrote: Irmen de Jong a écrit : Pickle and marshal are not safe. They can do harmful things if fed maliciously constructed data. That is a pity, because marshal is fast. I need a fast and safe (secure) marshaler. Is xdrlib the only option? I would expect that it is fast

Re: is there a safe marshaler?

2005-02-10 Thread Irmen de Jong
Hello Guido [EMAIL PROTECTED] wrote: Irmen de Jong wrote: Pickle and marshal are not safe. They can do harmful things if fed maliciously constructed data. That is a pity, because marshal is fast. I think marshal could be fixed; the only unsafety I'm aware of is that it doesn't

Re: XDR? (was Re: is there a safe marshaler?)

2005-02-10 Thread Irmen de Jong
PA wrote: On Feb 10, 2005, at 15:01, Irmen de Jong wrote: Is xdrlib the only option? I would expect that it is fast and safe because it (the xdr spec) has been around for so long. XDR? Like Sun's "XDR: External Data Representation standard"? http://www.faqs.org/rfcs/rf

Re: is there a safe marshaler?

2005-02-10 Thread Irmen de Jong
Alan Kennedy wrote: [Irmen de Jong] Pickle and marshal are not safe. They can do harmful things if fed maliciously constructed data. That is a pity, because marshal is fast. I need a fast and safe (secure) marshaler. Hi Irmen, I'm not necessarily proposing a solution to your problem, b

Re: XDR? (was Re: is there a safe marshaler?)

2005-02-10 Thread Irmen de Jong
PA wrote: Sorry if this is off-topic, I didn't follow the thread from the very beginning, but wouldn't something like YAML work for you perhaps? http://yaml.org/ Perhaps, but the spec makes my skin crawl. Also, it seems ill-fit for efficient machine-to-machine communication (yaml seems to be des

Re: is there a safe marshaler?

2005-02-10 Thread Irmen de Jong
Hi Alan Alan Kennedy wrote: Well, the python JSON codec provided appears to use eval, which might make it *seem* unsecure. http://www.json-rpc.org/pyjsonrpc/index.xhtml But a more detailed examination of the code indicates, to this reader at least, that it can be made completely secure very easi

Re: is there a safe marshaler?

2005-02-11 Thread Irmen de Jong
cmkl wrote: but can't effbot's fast cElementree be used for PYROs XML_PICKLE and would it be safe and fast enough? ElementTree's not a marshaler. Or has it object (de)serialization included? --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: is there a safe marshaler?

2005-02-11 Thread Irmen de Jong
Fredrik Lundh wrote: import os os.path.getsize("BL.xml") 1302 from xml.dom import minidom x = minidom.parse("BL.xml") (have patience. have lots of patience.) Hehe, the XML killer file "BillionLaughs"... correct? --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: is there a safe marshaler?

2005-02-11 Thread Irmen de Jong
Alan Kennedy wrote: I should learn to keep my mouth zipped :-L :-D OK, I really don't have time for a detailed examination of either the JSON spec or the python impl of same. And I *definitely* don't have time for a detailed security audit, much though I'd love to. No problem. The patch you wrote

Re: is there a safe marshaler?

2005-02-11 Thread Irmen de Jong
Fredrik Lundh wrote: the problem is that the following may or may not reach the "done!" statement, somewhat depending on python version, memory allocator, and what data you pass to dumps. import marshal data = marshal.dumps((1, 2, 3, "hello", 4, 5, 6)) for i in range(len(data), -1, -1): try:

Re: Web interface GUI??

2005-02-12 Thread Irmen de Jong
Luc wrote: So I am looking for another solution with a web interface that should work with linux and windows XP. I had a look to zope but was afraid with the complexity and debug difficulties. Are there some other solutions? Yes. A lot: http://www.python.org/moin/WebProgramming I know someone who s

Re: is there a safe marshaler?

2005-02-12 Thread Irmen de Jong
Alan Kennedy wrote: [Irmen de Jong] Interestingly enough, I just ran across "Flatten": http://sourceforge.net/project/showfiles.php?group_id=82591&package_id=91311 "...which aids in serializing/unserializing networked data securely, without having to fear execution of code o

Re: ANN: pyMinGW support for Python 2.3.5 (final) is available

2005-02-12 Thread Irmen de Jong
Simon John wrote: Maybe I'll fork out the 100usd for Visual Studio .NET 2003 after all $100? Where? Last time I looked it was closer to $800. --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: multi threading in multi processor (computer)

2005-02-12 Thread Irmen de Jong
Paul Rubin wrote: John Lenton <[EMAIL PROTECTED]> writes: and buying more, cheap computers gives you more processing power than buying less, multi-processor computers. The day is coming when even cheap computers have multiple cpu's. See hyperthreading and the coming multi-core P4's, and the final

Re: Text files read multiple files into single file, and then recreate the multiple files

2005-02-12 Thread Irmen de Jong
[EMAIL PROTECTED] wrote: Hiya, The title says it all really, but im a newbie to python sort of. I can read in files and write files no probs. But what I want to do is read in a couple of files and output them to one single file, but then be able to take this one single file and recreate the files I

Re: SCons build tool speed

2005-02-12 Thread Christopher De Vries
On Sat, Feb 12, 2005 at 07:16:02PM +, ted wrote: > How does the speed of the Scons build tool compare with Ant? I would recommend asking this question on [EMAIL PROTECTED] , but my impressions is that most of the time is probably spent in the compiler. If you are working on a java project you

ANN: Pyro 3.5 beta (remote objects)

2005-02-13 Thread Irmen de Jong
log in the manual: http://pyro.sourceforge.net/pyro-manual/12-changes.html#latest Because it is a beta release, there may still be bugs. Please test this version and let me know of any issues. Have fun, and thanks for your interest, support, and feedback! --Irmen de Jong ---> What is Pyro? Pyro

Re: Q: Portable Way to Make Files Read Only

2005-02-13 Thread Christopher De Vries
On Sun, Feb 13, 2005 at 01:25:02PM -0600, Efrat Regev wrote: > I would like to recurse through a directory and make files (which match > a specific criteria) read only. From searching the Internet, I found > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303343 > which shows how to

Re: is there a safe marshaler?

2005-02-14 Thread Irmen de Jong
Paul Rubin wrote: There's another issue with marshal that makes it unsuitable for Pyro, which is that its data format is (for legitimate reasons) not guaranteed to be the same across different Python releases. That means that if the two ends of the Pyro application aren't using the same Python ver

Re: is there a safe marshaler?

2005-02-14 Thread Irmen de Jong
Paul Rubin wrote: Yes, however, you can at least set the protocol level. Marshal doesn't give you that option. That's right. So good for Pyro then :) It works most of the time, even across different Python versions, unless using mobile code. What do you do about the security issue if you're using

Re: is there a safe marshaler?

2005-02-14 Thread Irmen de Jong
Well, ok, if you trust then other end then I think it's enough to just authenticate all the pickles (say using hmac.py) without needing something as heavyweight as SSL. An interesting idea that hadn't crossed my mind yet. Pyro *does* already have connection authentication that uses md5 (and hmac s

Re: multi threading in multi processor (computer)

2005-02-14 Thread Irmen de Jong
Leif K-Brooks wrote: Irmen de Jong wrote: the GIL must die. I couldn't resist: http://www.razorvine.net/img/GIL.jpg Neither could I: http://ecritters.biz/diegil.png (In case it's not entirely obvious, the stick figure just slices the GIL into two pieces with his sword, causing it

Re: is there a safe marshaler?

2005-02-14 Thread Irmen de Jong
Paul Rubin wrote: Yes, that's what I meant, using hmac to authenticate using a shared secret, sending the rest in the clear. Note you should also put sequence numbers in the messages, to stop the attacker from fooling you by selectively deleting or replaying messages. Thanks for the tip. I'll thin

Re: is there a safe marshaler?

2005-02-14 Thread Irmen de Jong
Fredrik Lundh wrote: the bug had nothing to do with the XML-RPC protocol itself; True, sorry for the confusion. I should have written it more precisely. it was a weakness in the SimpleXMLRPCServer framework which used reflection to automatically publish instance methods (if you use getattr repeated

Re: is there a safe marshaler?

2005-02-14 Thread Irmen de Jong
Paul Rubin wrote: Hmm, you also want a random blob in each packet (including the session start) included in the authentication of the next packet, so the attacker can't cut and paste messages from old sessions into the current ones. You know, by the time you're through designing this you may be be

Re: Calling a function from module question.

2005-02-15 Thread Irmen de Jong
Sean wrote: Then I would have a script that uses the print_this function defined in the module without using the module name in the call. from module_name import print_this or, even: from module_name import print_this as other_nice_name --Irmen -- http://mail.python.org/mailman/listinfo/python-lis

Re: SHA1 broken

2005-02-16 Thread Irmen de Jong
Tim Churches wrote: Also, the new findings only apply to hash collisions, not to the invertibility of SHA1 hashes - thus, as Schneier points out, uses of keyed hashes (such as HMAC) are not compromised by this. What about HMAC-MD5? --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying Socket Problem

2005-02-18 Thread Irmen de Jong
John Abel wrote: I'm hoping this is something simple, and someone can point me in the right direction here. I have a class based on SocketServer (ThreadingTCPServer), and I've used makefile on the socket so I use the "for in " routine. My client sends it a small amount of data. However, both

Re: unicode and socket

2005-02-18 Thread Irmen de Jong
aurora wrote: You could not. Unicode is an abstract data type. It must be encoded into octets in order to send via socket. And the other end must decode the octets to retrieve the unicode string. Needless to say the encoding scheme must be consistent and understood by both ends. So use pickle

Re: unicode and socket

2005-02-18 Thread Irmen de Jong
Irmen de Jong wrote: aurora wrote: You could not. Unicode is an abstract data type. It must be encoded into octets in order to send via socket. And the other end must decode the octets to retrieve the unicode string. Needless to say the encoding scheme must be consistent and understood by

Re: Python Modules for Various Internet Protocols?

2005-02-24 Thread Christopher De Vries
On Thu, Feb 24, 2005 at 11:11:07AM -0600, Efrat Regev wrote: > I was wondering whether there are any Python modules for various > Internet protocols, ... Twisted (http://twistedmatrix.com/products/twisted) is an event driven framework for writing network applications. It includes many internet

Re: Canonical way of dealing with null-separated lines?

2005-02-24 Thread Christopher De Vries
On Wed, Feb 23, 2005 at 10:54:50PM -0500, Douglas Alan wrote: > Is there a canonical way of iterating over the lines of a file that > are null-separated rather than newline-separated? I'm not sure if there is a canonical method, but I would recommending using a generator to get something like this

Re: Canonical way of dealing with null-separated lines?

2005-02-24 Thread Christopher De Vries
On Thu, Feb 24, 2005 at 02:03:52PM -0500, Douglas Alan wrote: > Thanks for the generator. It returns an extra blank line at the end > when used with "find -print0", which is probably not ideal, and is > also not how the normal file line iterator behaves. But don't worry > -- I can fix it. Sorry.

Re: Canonical way of dealing with null-separated lines?

2005-02-24 Thread Christopher De Vries
On Fri, Feb 25, 2005 at 07:56:49AM +1100, John Machin wrote: > Try this: > !def readweird(f, line_end='\0', bufsiz=8192): > !retain = '' > !while True: > !instr = f.read(bufsiz) > !if not instr: > !# End of file > !break > !splitstr = ins

Re: bsddb for k, v in db.items(): do order the numbers ?

2005-02-28 Thread Christopher De Vries
On Mon, Feb 28, 2005 at 08:30:59AM -0800, [EMAIL PROTECTED] wrote: > WHen I use the code below and printing all the results i get this: > -- > 0 1 10 > 11 2 3 > 4 5 6 > 7 8 9 > -- > But I want > -- > 0 1 2 > 3 4 5 > 6 7 8 > 9 10 11 > -- If you want your key, value pairs in a certai

Re: bsddb for k, v in db.items(): do order the numbers ?

2005-03-02 Thread Christopher De Vries
On Wed, Mar 02, 2005 at 01:31:04PM +0300, Denis S. Otkidach wrote: > You are not right, records in BTree (btopen) are certainly sorted. For > positive integers you can pack keys with struct.pack('>I', value). You're right... I missed the btopen (rather a key thing to miss I know, but when you hav

ANN: Snakelets 1.38 (simple-to-use web app server with dynamic pages)

2005-03-19 Thread Irmen de Jong
config file (see docs) and then run the serv.py script, or the monitor.py script if you want to start it as a daemon (on Unix). Enjoy, --Irmen de Jong. P.S. if you want to see it in action, visit http://www.razorvine.net/snake/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Persistent objects

2004-12-12 Thread Irmen de Jong
Paul Rubin wrote: Basically I wish there was a way to have persistent in-memory objects in a Python app, maybe a multi-process one. So you could have a persistent dictionary d, and if you say d[x] = Frob(foo=9, bar=23) that creates a Frob instance and stores it in d[x]. Then if you exit the a

Re: Email filters in python

2004-12-17 Thread Christopher De Vries
I use fetchmail in daemon mode and have procmail set up to filter my email through bogofilter (http://bogofilter.sourceforge.net/). As for outgoing mail postfix, exim, and sendmail are popular. From my laptop I do use a python script to cache mail my mail when I'm not connected. I then use a script

Re: Python vs. Perl

2004-12-11 Thread Christopher De Vries
Roy Smith already touched on regular expressions, but as far as features go, I would say that the real difference between python and perl is not in the features, but in the philosophy. It seems to me that any program you can write in python could also be written in perl. What it comes down to for m

Re: List limits

2004-12-20 Thread Christopher De Vries
It is possible to store 70,000 items in a list (try "l = range(7)"), but the best way to check if you can store all the items you need to store is to try it. After all if they are all very large you might potentially run out of memory. Chris -- http://mail.python.org/mailman/listinfo/python-

Re: Parallelization with Python: which, where, how?

2004-12-21 Thread Irmen de Jong
Jp Calderone wrote: On 21 Dec 2004 05:04:36 -0800, Mike M?ller <[EMAIL PROTECTED]> wrote: Can someone recommend a parallelization approach? Are there examples or documentation? Has someone got experience with stability and efficiency? I am successfully using pyro http://pyro.sourceforge.net for my

Re: Python on Linux Cluster

2004-12-23 Thread Irmen de Jong
Gurpreet Sachdeva wrote: I have shifted my python script on a 4 node open ssi cluster. Please guide me what changes do I have to do in my python scripts to fully utilize the cluster. How do we introduce parralel processing in python??? There was a very recent thread about this subject: http://tinyu

Re: Sending hex number as is

2005-03-21 Thread Irmen de Jong
[EMAIL PROTECTED] wrote: > This question may be ased before, but I couldn't find the answer > searching the archive. > > Basically, I just want to send a hex number from one machine to the > next: > > for example > > msg = "Length is " > n = '\x81' > msg += n > sock.send(msg) > > The problem is

<    1   2   3   4   5   6   7   8   9   10   >