Re: use strings to call functions

2010-02-09 Thread Steven D'Aprano
On Tue, 09 Feb 2010 07:29:33 +, Paul Rudin wrote: >> It is surprisingly difficult to sanitize strings in Python to make them >> safe to pass to eval. Unless you are prepared to trust the input data >> explicitly, it's best to just avoid eval. > > Despite the fact that it's used in the standar

Re: Modifying Class Object

2010-02-09 Thread Steven D'Aprano
On Tue, 09 Feb 2010 08:19:56 +0100, Alf P. Steinbach wrote: > You don't have anything /but/ pointers in Python. x = 5 y = "hello" You want us to accept that the values of x and y are some mysterious pointer entities rather than the integer object 5 and the string object "hello". At the point

Re: Doctests and decorated methods don't get along

2010-02-09 Thread Diez B. Roggisch
Am 06.02.10 12:48, schrieb Steven D'Aprano: It seems that doctest doesn't discover or execute doctests in methods which have been decorated. Here is my test file: # == class MyStaticMethod(object): """Emulate built-in staticmethod descriptor.""" def __init__(self, f): se

Re: use strings to call functions

2010-02-09 Thread Diez B. Roggisch
Am 09.02.10 07:00, schrieb OdarR: On 9 fév, 02:50, Jean-Michel Pichavant wrote: Aahz wrote: In article<0efe23a6-b16d-4f92-8bc0-12d056bf5...@z26g2000yqm.googlegroups.com>, OdarR wrote: and with eval(), did you try ? WARNING: eval() is almost always the wrong answer to any question Some

To (monkey)patch or not to (monkey)patch, that is the question

2010-02-09 Thread George Sakkis
I was talking to a colleague about one rather unexpected/undesired (though not buggy) behavior of some package we use. Although there is an easy fix (or at least workaround) on our end without any apparent side effect, he strongly suggested extending the relevant code by hard patching it and postin

Re: use strings to call functions

2010-02-09 Thread Klaus Neuner
> go to hell ;-), it is part of the language, it seems to match the > aforementioned question. Thats right. In fact, your code is the precise analogy of my Prolog example in Python. Obviously, eval() and call() are both inherently dangerous. They should never be used in programs that are used in p

Re: Modifying Class Object

2010-02-09 Thread Alf P. Steinbach
* Steven D'Aprano: On Tue, 09 Feb 2010 08:19:56 +0100, Alf P. Steinbach wrote: You don't have anything /but/ pointers in Python. x = 5 The above assigns to x a pointer to an object whose value is 5: x --> 5 y = "hello" Ditto result: y --> "hello" And if now do x

Re: intolerant HTML parser

2010-02-09 Thread Stefan Behnel
Lawrence D'Oliveiro, 08.02.2010 22:39: > In message <4b6fe93d$0$6724$9b4e6...@newsspool2.arcor-online.net>, Stefan > Behnel wrote: > >> - generating HTML using a tool that guarantees correct HTML output > > Where do you think these tools come from? Usually PyPI. Stefan -- http://mail.python.o

Re: Python and Ruby

2010-02-09 Thread waku
On Feb 2, 10:49 pm, Jonathan Gardner wrote: > On Feb 2, 2:21 am,waku wrote: [...] > > there are languages where indentation can be either enforced and allow > > one to omit some syntactic nuissance like braces or begin-end clauses, > > or made optional, requiring other syntactic means for delimi

Re: use strings to call functions

2010-02-09 Thread Stefan Behnel
Klaus Neuner, 09.02.2010 10:04: > my program is supposed to parse files that I have created myself and that > are on my laptop. It is not supposed to interact with anybody else > than me. Famous last words. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Simulating logging.exception with another traceback

2010-02-09 Thread Joan Miller
On 8 feb, 21:13, Vinay Sajip wrote: > On Feb 7, 11:22 am, Joan Miller wrote: > > > > > I would want to get the output from `logging.exception` but with > > traceback from the caller function (I've already all that > > information). > > > This would be the error withlogging.exception: > >

Re: Pickling an extension type subclasses problems

2010-02-09 Thread Gabriel Genellina
En Fri, 05 Feb 2010 11:25:02 -0300, Gaetan de Menten escribió: I am trying to write an (optional!) C extension for SQLAlchemy, and I am struggling to make an extension type picklable *and* using the same format as the pure Python version (so that computers with the C extension can unpickle pick

Re: Need installer recommendation

2010-02-09 Thread Gabriel Genellina
En Sat, 06 Feb 2010 12:45:39 -0300, Alan Biddle escribió: I could use a recommendation on a free installer for use by an unsophisticated programmer, that would be me, for some simple programs which are a bit more than "Hello World," but only a little. Basically reading text files and processin

Re: Python Logic Map/Logic Flow Chart. (Example Provided)

2010-02-09 Thread Jean-Michel Pichavant
Carl Banks wrote: On Feb 8, 12:20 pm, spike wrote: Has anyone been able to come across a Python logic map or Python logic flow chart? An example can be seen on the right under History:http://en.wikipedia.org/wiki/Usenet#History This would be very helpful for all users. Begin |

Re: Python Logic Map/Logic Flow Chart. (Example Provided)

2010-02-09 Thread Jean-Michel Pichavant
I use this one: Begin | | V Start Mail client | | V Ask python-list <-+ | | | | Vwhat a bunch of dumbass wait 2 min| | | | | No. V | Did you get any answer

Re: Modifying Class Object

2010-02-09 Thread Duncan Booth
"Alf P. Steinbach" wrote: > A copyable reference is a pointer. That is, a "pointer", in e.g. the > Java sense, > and in the general language independent sense, means a copyable > reference -- as illustrated e.g. in the Stanford computer science > 101 course page I > referred you to earli

Re: Socket Error: Permission Denied (Firewall)

2010-02-09 Thread W. eWatson
(corrected typos) I decided to go with outbound in McAfee. Now when I run the program, I get a long list of messages about deprecations and NumpyTest will be removed in the next release. please update code to nose or unittest. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Logic Map/Logic Flow Chart. (Example Provided)

2010-02-09 Thread Steve Holden
spike wrote: > On Feb 8, 1:35 pm, Gary Herron wrote: >> spike wrote: >>> Has anyone been able to come across a Python logic map or Python logic >>> flow chart? >>> An example can be seen on the right under History: >>> http://en.wikipedia.org/wiki/Usenet#History >>> This would be very helpful for

Re: equivalent of Ruby's Pathname?

2010-02-09 Thread Steve Holden
Phlip wrote: > Carl Banks wrote: > >> I don't know if it was the reason it was rejected, but a seriously >> divisive question is whether the path should be a subset of string. > > OMG that's nothing but the OO "circle vs ellipse" non-question. Glad > to see the Committee derailed a perfectly good

Re: Modifying Class Object

2010-02-09 Thread Steve Holden
Stephen Hansen wrote: > On Mon, Feb 8, 2010 at 6:42 PM, Steve Holden > wrote: > > Stephen Hansen wrote: > [...] > > P.S. I couldn't resist. :( > > > > And here I was, sitting on my hands ... but someone was wrong on the > Internet, so D'Aprano

Re: Modifying Class Object

2010-02-09 Thread Steve Holden
Alf P. Steinbach wrote: > * Stephen Hansen: [...] >> I've heard that before, and have no idea why, nor any real interest in >> solving it: I don't want to read cpl via Usenet, and prefer to read it >> as a mailing list. Somewhere between Gmail->python.org->python.org >> 's usenet

Re: equivalent of Ruby's Pathname?

2010-02-09 Thread Chris Rebert
On Tue, Feb 9, 2010 at 4:38 AM, Steve Holden wrote: > Phlip wrote: >> Carl Banks wrote: >> >>> I don't know if it was the reason it was rejected, but a seriously >>> divisive question is whether the path should be a subset of string. >> >> OMG that's nothing but the OO "circle vs ellipse" non-ques

Re: ANN: obfuscate

2010-02-09 Thread Roy Smith
In article <00fa27a3$0$15628$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > I am pleased to announce the first public release of obfuscate 0.2.2a. > > http://pypi.python.org/pypi/obfuscate/0.2.2a > > obfuscate is a pure-Python module providing classical encryption > algorithms suitable

Re: event handling in pyuthon

2010-02-09 Thread Tiago Katcipis
On Tue, Feb 9, 2010 at 5:20 AM, Bujji wrote: > hi all, > any event handling mechanisms in python ? > i want event handler examples in python > dont know if it is this that you are looking for: http://home.gna.org/py-notify/ > > > Thanks > Bujji > > > > -- > http://mail.python.org/mailman/list

Re: equivalent of Ruby's Pathname?

2010-02-09 Thread Phlip
Gregory Ewing wrote: > It wouldn't just be open() that people would want modified -- > it would be every other function that takes a pathname as > well. Then refer to the same argument against implicit type conversions in C+ +. A ::std::string must call .c_str() to turn into a lowly char*, befor

Plese take me off the mailing list

2010-02-09 Thread Nevills, Carolyn
Good morning, Please take my name off your mailing list . Thanks, -- http://mail.python.org/mailman/listinfo/python-list

errno 107 socket.recv issue

2010-02-09 Thread Jordan Apgar
I have a simple tcp server and client where the server sits and waits for a message and then processes it, my client sends its first message to the server. On the server I receive: socket.error: [Errno 107] Transport endpoint is not connected when calling msg = self.socket.recv(self.buffer) My c

Re: Need installer recommendation

2010-02-09 Thread Alan Biddle
Thanks you very much for the suggestion. I will give it a try. Since I posted the original question, I have tried PyInstaller. I am using Python 2.6.4, which is technically not supported, but it worked fine for the simple programs I tried, and simple enough even for me. ;) -- Alan -- http:/

Re: errno 107 socket.recv issue

2010-02-09 Thread Steve Holden
Jordan Apgar wrote: > I have a simple tcp server and client where the server sits and waits > for a message and then processes it, my client sends its first message > to the server. On the server I receive: > > socket.error: [Errno 107] Transport endpoint is not connected > when calling > msg = s

Re: Executing Commands From Windows Service

2010-02-09 Thread T
On Feb 8, 2:25 pm, David Bolen wrote: > T writes: > > I have a script, which runs as a Windows service under the LocalSystem > > account, that I wish to have execute some commands.  Specifically, the > > program will call plink.exe to create a reverse SSH tunnel.  Right now > > I'm using subproce

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: I have a simple tcp server and client where the server sits and waits for a message and then processes it, my client sends its first message to the server. On the server I receive: socket.error: [Errno 107] Transport endpoint is not connected when calling msg = self.socket.r

Python-URL! - weekly Python news and links (Feb 9)

2010-02-09 Thread Gabriel Genellina
QOTW: "You see? That's what I like about the Python community: people even apologise for apologising :)" - Tim Golden http://groups.google.com/group/comp.lang.python/msg/858d1c31d0c2adff The third alpha version of Python 2.7 is ready for testing: http://groups.google.com/group/c

Re: errno 107 socket.recv issue

2010-02-09 Thread Jordan Apgar
I found my car ;) here's the server: class commServer: """Class to hold a tcp server and interact with with it allows for a wrapper around socket class to keep code clean""" def __init__ (self, host, hostid, port, buff =1024): self.host = host self.hostid = hostid #id

Re: Python 3: Plist as OrderedDict

2010-02-09 Thread Gnarlodious
On Feb 9, 12:15 am, Raymond Hettinger wrote: > You may be able to monkey patch an OrderedDict into the PlistParser. > Here's an untested stab at it: > >     from collections import OrderedDict >     import plistlib >     plistlib._InteralDict = OrderedDict Genius! After fixing the misspelled Inte

Re: equivalent of Ruby's Pathname?

2010-02-09 Thread Bruno Desthuilliers
Phlip a écrit : Gregory Ewing wrote: In any case, introducing any kind of path object at this late stage of the language's development would result in More Than One Way to represent pathnames, with neither of them being the obvious choice. Ah, now we get down to the root of the problem. Becau

Re: Modifying Class Object

2010-02-09 Thread Stephen Hansen
On Mon, Feb 8, 2010 at 10:35 PM, Alf P. Steinbach wrote: > Right. > > "pass by value" is a lower level notion. > > And as you show below, in the paragraph marked [1], it can be used to > describe call by sharing very succinctly and precisely, just as I did... ;-) No. There's nothing at all succ

PostgreSQL driver for Python applications that supports bytea correctly?

2010-02-09 Thread CyclingGuy
Can anyone recommend a PostgreSQL driver for Python that supports selecting and inserting bytea types? I'm not looking to write server functions in Python, just client applications. Thank you Eric. -- http://mail.python.org/mailman/listinfo/python-list

Programing family

2010-02-09 Thread AON LAZIO
I have thought funny things If we think all languages are like a family I could draft them like this (Python base) C is Python's Mom C++ : Dad Pascal/Assembly : Grandparents C# : Uncle Java : Ant Ruby: Cousin Perl : Girlfriend What u guys think? XD -- Passion is my style -- http://mail.pytho

Call for Paper The International Journal of Computer Science (IJCS)

2010-02-09 Thread editor ijcs
Call for Paper The International Journal of Computer Science (IJCS) publishes original papers on all subjects relevant to computer science, communication network, and information systems. The highest priority will be given to those contributions concerned with a discussion of the background of a pr

Re: The Case For Do-Once

2010-02-09 Thread Lawrence D'Oliveiro
In message , Lawrence D'Oliveiro wrote: > The basic control flow is this: > * Unconditionally initialize all dynamic storage to nil > * Do the main body of the code, aborting in any error > * Regardless of success or failure of the above, dispose of all > allocated dynamic storag

Re: Socket Error: Permission Denied

2010-02-09 Thread W. eWatson
I decided to go with outbound. Now when I run the program, I get a long of messabge about deprecations and NumpyTest will be removed in the next release. please update code to nose or unittest. -- http://mail.python.org/mailman/listinfo/python-list

Re: Executing Commands From Windows Service

2010-02-09 Thread David Bolen
T writes: > I have a script, which runs as a Windows service under the LocalSystem > account, that I wish to have execute some commands. Specifically, the > program will call plink.exe to create a reverse SSH tunnel. Right now > I'm using subprocess.Popen to do so. When I run it interactively

Re: Stephen -- Bruce?

2010-02-09 Thread Stefan Behnel
Mensanator, 05.02.2010 00:36: > On Feb 4, 5:13 pm, "Alf P. Steinbach" wrote: >> What's this about all the Stephen'ses here? >> >> Shouldn't it be Bruce? > > Of course. We just call everyone Stephen to avoid confusion. Some people even manage to adapt the spellings accordingly. Stefan -- http://

Re: Python-URL! - weekly Python news and links (Feb 9)

2010-02-09 Thread Marius Gedminas
The last three URLs are malformed: On Feb 9, 5:03 pm, "Gabriel Genellina" wrote: >     There is no module in the standard library to handle filesystem paths >     in an OO way - but why? >        http://groups.google.com/group/comp.lang.pythonf580fb3763208425ece/ > >     A "History Channel" speci

Re: Modifying Class Object

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 4:40 AM, Steve Holden wrote: > Stephen Hansen wrote: > > This is getting out of hand. > > > > First, someone thought I was you. > > > > Now you think I'm D'Aprano. > > > > I'm just gonna go by Bob for now on. > > > > :) > > > Sorry about that, Bob. But you have to admit you

Re: ANN: obfuscate

2010-02-09 Thread Daniel Fetchinson
> I am pleased to announce the first public release of obfuscate 0.2.2a. > > http://pypi.python.org/pypi/obfuscate/0.2.2a > > obfuscate is a pure-Python module providing classical encryption > algorithms suitable for obfuscating and unobfuscating text. > > obfuscate includes the following ciphers:

Re: Python-URL! - weekly Python news and links (Feb 9)

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 7:03 AM, Gabriel Genellina wrote: >After a false start, finally we get our first "Is it Call-By-Value or >Call-By-Reference?" thread of the year! >http://groups.google.com/group/comp.lang.pythonfd36962c4970ac487ea/ LOL. Can we set up some sort of "argh" fi

Re: To (monkey)patch or not to (monkey)patch, that is the question

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 12:54 AM, George Sakkis wrote: > So I'm wondering if there is a consensus on when it's better to (hard) > patch, monkey patch or just try to work around a third party package > that doesn't do exactly what one would like. Does it have mainly to do > with the reason for the p

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: I found my car ;) here's the server: class commServer: """Class to hold a tcp server and interact with with it allows for a wrapper around socket class to keep code clean""" def __init__ (self, host, hostid, port, buff =1024): self.host = host se

Re: PostgreSQL driver for Python applications that supports bytea correctly?

2010-02-09 Thread Jean-Michel Pichavant
CyclingGuy wrote: Can anyone recommend a PostgreSQL driver for Python that supports selecting and inserting bytea types? I'm not looking to write server functions in Python, just client applications. Thank you Eric. Did you try any ? I know about pgdb, and since it has a function called esca

Re: Programing family

2010-02-09 Thread Stephen Hansen
On Mon, Feb 8, 2010 at 5:39 PM, AON LAZIO wrote: > I have thought funny things > If we think all languages are like a family > I could draft them like this (Python base) > > C is Python's Mom > I can see this. > C++ : Dad > Ick, no. C++ is the dirty Uncle who gets touchy with us in inappropriat

Re: timer for a function

2010-02-09 Thread mk
Stephen Hansen wrote: Question: how can I do that? Use another threaded class? Is there some other way? First of all, thanks for answer! What OS? Does this have to be OS-independant? Err, sorry -- this is Linux/UNIX only. Are you using more then one transport/SSLClient in your pro

Re: Modifying Class Object

2010-02-09 Thread Steve Holden
Stephen Hansen wrote: > On Mon, Feb 8, 2010 at 10:35 PM, Alf P. Steinbach > wrote: > > Right. > > "pass by value" is a lower level notion. > > And as you show below, in the paragraph marked [1], it can be used > to describe call by sharing very succinctly

Re: Socket Error: Permission Denied

2010-02-09 Thread Stephen Hansen
On Mon, Feb 8, 2010 at 7:38 PM, W. eWatson wrote: > I'm using McAffee. I see it was pythonw.exe blocked in red. There are > several choices: Allow Access, Allow Outboubnd only > Block (current), Remove Prgrm permission, Learn More. > > Outbound only seem reasonable, but why does the blocking keep

Re: Python 3: Plist as OrderedDict

2010-02-09 Thread Gnarlodious
On Feb 9, 12:15 am, Raymond Hettinger wrote: > You may be able to monkey patch an OrderedDict into the PlistParser. > Here's an untested stab at it: >     from collections import OrderedDict >     import plistlib >     plistlib._InteralDict = OrderedDict Genius! After fixing the misspelled Inter

Re: Programing family

2010-02-09 Thread rodrick brown
Don't forget his little brother Go! Sent from my iPhone 3GS. On Feb 8, 2010, at 8:39 PM, AON LAZIO wrote: I have thought funny things If we think all languages are like a family I could draft them like this (Python base) C is Python's Mom C++ : Dad Pascal/Assembly : Grandparents C# : Uncle

How to measure elapsed time under Windows?

2010-02-09 Thread Grant Edwards
What's the correct way to measure small periods of elapsed time. I've always used time.clock() in the past: start = time.clock() [stuff being timed] stop = time.clock() delta = stop-start However on multi-processor machines that doesn't work. Sometimes I get negative values for de

Re: Python-URL! - weekly Python news and links (Feb 9)

2010-02-09 Thread Tim Golden
On 09/02/2010 15:37, Stephen Hansen wrote: On Tue, Feb 9, 2010 at 7:03 AM, Gabriel Genellinawrote: After a false start, finally we get our first "Is it Call-By-Value or Call-By-Reference?" thread of the year! http://groups.google.com/group/comp.lang.pythonfd36962c4970ac487ea/

Re: ANN: obfuscate

2010-02-09 Thread Robert Kern
On 2010-02-09 09:37 AM, Daniel Fetchinson wrote: I am pleased to announce the first public release of obfuscate 0.2.2a. http://pypi.python.org/pypi/obfuscate/0.2.2a obfuscate is a pure-Python module providing classical encryption algorithms suitable for obfuscating and unobfuscating text. obfu

Re: errno 107 socket.recv issue

2010-02-09 Thread r. clayton
> http://docs.python.org/library/socketserver.html > > JM each time a handler is spawned is it client specific? in other words when two clients send something to the server do handlers spawn for each of them or does everything just go into a single handler? -- http://mail.python.org/mailman/list

Re: errno 107 socket.recv issue

2010-02-09 Thread Jordan Apgar
> http://docs.python.org/library/socketserver.html > > JM each time a handler is spawned is it client specific? in other words when two clients send something to the server do handlers spawn for each of them or does everything just go into a single handler? -- http://mail.python.org/mailman/list

Re: Programing family

2010-02-09 Thread Bruno Desthuilliers
On Feb 8, 2010, at 8:39 PM, AON LAZIO wrote: I have thought funny things If we think all languages are like a family Then it would be a very incestuous family fore sure. I could draft them like this (Python base) C is Python's Mom C++ : Dad Not that much C++ in Python, IMHO. If that's f

Re: PostgreSQL driver for Python applications that supports bytea correctly?

2010-02-09 Thread D'Arcy J.M. Cain
On Tue, 9 Feb 2010 07:27:39 -0800 (PST) CyclingGuy wrote: > Can anyone recommend a PostgreSQL driver for Python that supports > selecting and inserting bytea types? > I'm not looking to write server functions in Python, just client > applications. http://www.PyGreSQL.org/ -- D'Arcy J.M. Cain

Re: Modifying Class Object

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 7:53 AM, Steve Holden wrote: > > [several paragraphs-worth of bothering further] > > So you didn't believe me when I said > > > Of course this won't make the slightest difference. "'When I use a > > word,' said Humpty ..." > It was early, I was barely awake. That paragraph

Re: Python 3: Plist as OrderedDict

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 8:07 AM, Gnarlodious wrote: > To extract the list I am saying this: > > ordered=plistlib.readPlist(path) > print(list(ordered)) # only a list of keys > print(ordered[list(ordered)[0]]) > > However this seems too laborious. is there an easier way? > I'm not familiar with p

Re: Executing Commands From Windows Service

2010-02-09 Thread Sean DiZazzo
On Feb 9, 6:52 am, T wrote: > On Feb 8, 2:25 pm, David Bolen wrote: > > > > > T writes: > > > I have a script, which runs as a Windows service under the LocalSystem > > > account, that I wish to have execute some commands.  Specifically, the > > > program will call plink.exe to create a reverse

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Stephen Hansen
On Tue, Feb 9, 2010 at 8:10 AM, Grant Edwards wrote: > However on multi-processor machines that doesn't work. > Sometimes I get negative values for delta. According to > google, this is due to a bug in Windows that causes the value > of time.clock() to be different depending on which core in a >

Re: Modifying Class Object

2010-02-09 Thread Terry Reedy
On 2/9/2010 12:12 AM, Alf P. Steinbach wrote: As far as the language spec is concerned the argument passing mechanism seems to me to be identical to assignments, not just "very much like". Except for the cross-namespace nature of the assignment, yes. Glad you agree. Your phrase "or objects

mac install

2010-02-09 Thread Thomas Nelson
I downloaded the 3.1.1 dmg from http://www.python.org/download/releases/3.1.1/ but when I run it I get the error "The folowing install step failed: run postflight script for python documentation." The bugs list has this bug at http://bugs.python.org/issue6934 but it's described as fixed. Is it on

Re: pyclutter anyone?

2010-02-09 Thread Aahz
In article , donn wrote: > >No one uses pyClutter? Never heard of it before. >I have some code, it does not work, but maybe this will start to help >solve the problem: You need to provide some more detail than "does not work". Perhaps this will help: http://www.catb.org/~esr/faqs/smart-ques

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: http://docs.python.org/library/socketserver.html JM each time a handler is spawned is it client specific? in other words when two clients send something to the server do handlers spawn for each of them or does everything just go into a single handler? docstring of

Re: ANN: obfuscate

2010-02-09 Thread Aahz
In article , Robert Kern wrote: >On 2010-02-09 09:37 AM, Daniel Fetchinson wrote: >>> >>> obfuscate is a pure-Python module providing classical encryption >>> algorithms suitable for obfuscating and unobfuscating text. >>> >>> DISCLAIMER: obfuscate is not cryptographically strong, and should not

Incorrect 'Host' header when using urllib2 to access a server by its IPv6 link-local address

2010-02-09 Thread slmnhq
I have a snippet of Python code that makes an HTTP GET request to an Apache web server (v 2.2.3) using urllib2. The server responds with an HTTP 400 error presumably because of a malformed 'Host' header. The snippet is quite simple: it creates a url based on IPv6 string literal syntax, then create

Re: To (monkey)patch or not to (monkey)patch, that is the question

2010-02-09 Thread Raymond Hettinger
On Feb 9, 12:54 am, George Sakkis wrote: > So I'm wondering if there is a consensus on when it's better to (hard) > patch, monkey patch or just try to work around a third party package > that doesn't do exactly what one would like. Does it have mainly to do > with the reason for the patch (e.g. fi

Re: errno 107 socket.recv issue

2010-02-09 Thread Jordan Apgar
thanks JM, at this point i switched over to this scheme and now I'm getting an error durring instantiation of the server: Server.py: from Crypto.PublicKey import RSA from ServerNegotiator import ServerNegotiator from sharedComs import * f = open("hostid") tup = stringToTuple(f.readline()[0:-1]) H

Pycrypto RSA Issue

2010-02-09 Thread Jordan Apgar
I am trying to encrypt public data along with another tuple and then decrypt it after sending. RSA is needed for negotiation of keys for AES. But I just get garbage after I decrypt it. This is what I'm attempting to do: from Crypto.PublicKey import RSA from Crypto import Random gkey = RSA.generat

Re: use strings to call functions

2010-02-09 Thread OdarR
On 9 fév, 11:01, Stefan Behnel wrote: > Klaus Neuner, 09.02.2010 10:04: > > > my program is supposed to parse files that I have created myself and that > > are on my laptop. It is not supposed to interact with anybody else > > than me. > > Famous last words. > > Stefan I knew it. Olivier -- htt

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Jean-Michel Pichavant
Grant Edwards wrote: What's the correct way to measure small periods of elapsed time. I've always used time.clock() in the past: start = time.clock() [stuff being timed] stop = time.clock() delta = stop-start However on multi-processor machines that doesn't work. Sometimes I get

Re: Pycrypto RSA Issue

2010-02-09 Thread Legrandin
> gkey = RSA.generate(384, Random.new().read) > string = str((gkey.publickey().__getstate__(),(333,444))) You are encrypting with RSA a piece of data which is way larger than the key size (48 bytes). -- http://mail.python.org/mailman/listinfo/python-list

Re: errno 107 socket.recv issue

2010-02-09 Thread George Trojan
Argument mismatch? Jordan Apgar wrote: servernegotiator = ServerNegotiator(host,HostID, port, key) class ServerNegotiator: def __init__(self, host, port, hostid, rsa_key, buf = 512): -- http://mail.python.org/mailman/listinfo/python-list

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: thanks JM, at this point i switched over to this scheme and now I'm getting an error durring instantiation of the server: Server.py: from Crypto.PublicKey import RSA from ServerNegotiator import ServerNegotiator from sharedComs import * f = open("hostid") tup = stringToTuple

Re: mac install

2010-02-09 Thread Gnarlodious
Hello. The answer is, I don't know. But I originally replaced my existing Python with 3.1.1. I then had to backtrack because some stuff broke. Nothing in the OS, but adapting every Python script on my HD was not what I wanted to do. So my Py3 executable is at: /Library/Frameworks/Python.framework/

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Grant Edwards
On 2010-02-09, Jean-Michel Pichavant wrote: > Grant Edwards wrote: >> What's the correct way to measure small periods of elapsed >> time. I've always used time.clock() in the past: >> >>start = time.clock() >>[stuff being timed] >>stop = time.clock() >> >>delta = stop-start >> >>

Re: errno 107 socket.recv issue

2010-02-09 Thread Jordan Apgar
On Feb 9, 1:51 pm, Jean-Michel Pichavant wrote: > Jordan Apgar wrote: > > thanks JM, > > > at this point i switched over to this scheme and now I'm getting an > > error durring instantiation of the server: > > Server.py: > > from Crypto.PublicKey import RSA > > from ServerNegotiator import ServerN

Re: Pycrypto RSA Issue

2010-02-09 Thread Jordan Apgar
On Feb 9, 1:27 pm, Legrandin wrote: > > gkey = RSA.generate(384, Random.new().read) > > string = str((gkey.publickey().__getstate__(),(333,444))) > > You are encrypting with RSA a piece of data which is way > larger than the key size (48 bytes). ah thanks Legrandin -- http://mail.python.org/mail

Re: Executing Commands From Windows Service

2010-02-09 Thread David Bolen
T writes: > The more testing I do, I think you may be right..I was able to get it > to work under a local admin account, and it worked under debug mode > (which would also have been running as this user). I'm a bit > surprised though - I was under the assumption that LocalSystem had > rights to

Re: Ternary plus

2010-02-09 Thread Martin Drautzburg
Carl Banks wrote: > You can have __add__ return a closure for the first addition, then > perform the operation on the second one. Example (untested): > > class Closure(object): > def __init__(self,t1,t2): > self.t1 = t1 > self.t2 = t2 > def __add__(self,t3): > #

Re: To (monkey)patch or not to (monkey)patch, that is the question

2010-02-09 Thread sjdevn...@yahoo.com
On Feb 9, 3:54 am, George Sakkis wrote: > I was talking to a colleague about one rather unexpected/undesired > (though not buggy) behavior of some package we use. Although there is > an easy fix (or at least workaround) on our end without any apparent > side effect, he strongly suggested extending

Re: Modifying Class Object

2010-02-09 Thread Alf P. Steinbach
* Duncan Booth: "Alf P. Steinbach" wrote: A copyable reference is a pointer. That is, a "pointer", in e.g. the Java sense, and in the general language independent sense, means a copyable reference -- as illustrated e.g. in the Stanford computer science 101 course page I referred you

Re: Modifying Class Object

2010-02-09 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Stephen Hansen: [...] I've heard that before, and have no idea why, nor any real interest in solving it: I don't want to read cpl via Usenet, and prefer to read it as a mailing list. Somewhere between Gmail->python.org->python.org 's

Re: Modifying Class Object

2010-02-09 Thread Steve Holden
Alf P. Steinbach wrote: > * Steve Holden: >> Alf P. Steinbach wrote: >>> * Stephen Hansen: >> [...] I've heard that before, and have no idea why, nor any real interest in solving it: I don't want to read cpl via Usenet, and prefer to read it as a mailing list. Somewhere between Gmail

Re: errno 107 socket.recv issue

2010-02-09 Thread Steve Holden
Jordan Apgar wrote: > On Feb 9, 1:51 pm, Jean-Michel Pichavant [...] >> you swapped port & hostID in your call >> >> JM > > tThanks guys it's working now... feel a little stupid though. Cool! regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming! Atlanta, F

New to Python

2010-02-09 Thread Quin
s = f.readline() if 'mystring' in s: print 'foundit' if 'mystring' not in s: print 'not found' if 'mystring' in s: print 'processing' this generates output: not found processing so, it doesn't find the substring, but goes into processing code anyway. This is using IronPython -- http://mail.p

Re: Modifying Class Object

2010-02-09 Thread Alf P. Steinbach
* Steve Holden: Alf P. Steinbach wrote: * Steve Holden: Alf P. Steinbach wrote: * Stephen Hansen: [...] I've heard that before, and have no idea why, nor any real interest in solving it: I don't want to read cpl via Usenet, and prefer to read it as a mailing list. Somewhere between Gmail->py

Re: Python-URL! - weekly Python news and links (Feb 9)

2010-02-09 Thread Gabriel Genellina
En Tue, 09 Feb 2010 12:32:54 -0300, Marius Gedminas escribió: The last three URLs are malformed: Sorry... It happens even in the best of families :) These are the right ones: There is no module in the standard library to handle filesystem paths in an OO way - but why? http://groups.

Re: Executing Commands From Windows Service

2010-02-09 Thread David Bolen
David Bolen writes: > Not from my past experience - the system account (LocalSystem for > services) can be surprising, in that it's pretty much unlimited access > to all local resources, but severely limited in a handful of cases, > one of which is any attempt to access the network. I can't reca

Re: Python and Ruby

2010-02-09 Thread Jonathan Gardner
On Feb 9, 1:51 am, waku wrote: > 'stupid', 'wrong', 'deficient', 'terrible', ...  you're using strong > words instead of concrete arguments, it might intimidate your > opponents, but is hardly helpful in a fair discussion. > In today's day and age, I don't know how a text editor which cannot do s

shelve.open generates (22, 'Invalid argument') Os X 10.5 with Python 2.5

2010-02-09 Thread seth
There is something you could possibly help me with. We have a code that creates a simple Python shelve database. We are able to serialize objects and store them in the dbm file. This seem to work the same on Windows XP Python 2.5, Ubuntu 9.1 with Python 2.6, but on Os X 10.5 with Python 2.5 the da

Re: PostgreSQL driver for Python applications that supports bytea correctly?

2010-02-09 Thread Jonathan Gardner
On Feb 9, 7:27 am, CyclingGuy wrote: > Can anyone recommend a PostgreSQL driver for Python that supports > selecting and inserting bytea types? > Can you name some that don't? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Grant Edwards
On 2010-02-09, Jean-Michel Pichavant wrote: > Grant Edwards wrote: >> What's the correct way to measure small periods of elapsed >> time. I've always used time.clock() in the past: >> >>start = time.clock() >>[stuff being timed] >>stop = time.clock() >> >>delta = stop-start >> >>

  1   2   >