Re: TypeError: can only concatenate list (not "tuple") to list

2010-01-04 Thread Chris Rebert
On Sun, Jan 3, 2010 at 11:51 PM, Gabriel Genellina wrote: > This > py> [1,2,3] + (4,5) > Traceback (most recent call last): >  File "", line 1, in > TypeError: can only concatenate list (not "tuple") to list Given that tuples are sometimes used as a poor man's object (i.e. collection of data fie

TypeError: can only concatenate list (not "tuple") to list

2010-01-04 Thread Gabriel Genellina
Is there any reason for this error? Apart from "nobody cared to write the code" py> [1,2,3] + (4,5) Traceback (most recent call last): File "", line 1, in TypeError: can only concatenate list (not "tuple") to list In-place addition += does work: py> a = [1,2,3] py> a += (4,5) py> a [1, 2

Re: TypeError: can only concatenate list (not "tuple") to list

2010-01-04 Thread Steven D'Aprano
On Mon, 04 Jan 2010 04:59:02 -0300, Gabriel Genellina wrote: > Is there any reason for this error? Apart from "nobody cared to write > the code" Yes, because such implicit conversions would be a bad idea. > py> [1,2,3] + (4,5) What result are you expecting? A list or a tuple? > Traceback

Re: TypeError: can only concatenate list (not "tuple") to list

2010-01-04 Thread Gabriel Genellina
En Mon, 04 Jan 2010 04:58:54 -0300, Chris Rebert escribió: On Sun, Jan 3, 2010 at 11:51 PM, Gabriel Genellina wrote: py> [1,2,3] + (4,5) Traceback (most recent call last): File "", line 1, in TypeError: can only concatenate list (not "tuple") to list Sorry, I inadvertedly posted an inco

RE: HAppy New Year

2010-01-04 Thread baboucarr sanneh
Oops ya rite.. Y didn't i think of that ?..neway thnx guys guess y we ave this mailing list to share ideas rite... Regards, Baboucarr. > Date: Sun, 3 Jan 2010 22:04:40 +0200 > Subject: Re: HAppy New Year > From: [email protected] > To: [email protected] > CC: [email protected] > >

Re: python mechanize proxy support question

2010-01-04 Thread alex23
On Jan 4, 5:42 pm, elca wrote: > how can i add proxy support into my mechanize script? > i was look for some reference , but not so much good hint from google. There are examples on using proxies with mechanize on the module's home page: http://wwwsearch.sourceforge.net/mechanize/ -- http://mail

Re: TypeError: can only concatenate list (not "tuple") to list

2010-01-04 Thread David Williams
> Is there any reason for this error? Apart from "nobody cared to write the > code" > > py> [1,2,3] + (4,5) > Traceback (most recent call last): > File "", line 1, in > TypeError: can only concatenate list (not "tuple") to list > > In-place addition += does work: > > py> a = [1,2,3] > py> a +

Re: twenty years ago Guido created Python

2010-01-04 Thread Daniel Fetchinson
> Sorry I failed to salvage the thread. Go, quick, these threads are all around us! They are popping up everywhere! Go, go, quick! There is another troll thread right there! They are encircling us! They keep coming! At least one troll thread started on usenet just since I started typing! Quick, qu

Re: How to Suppress Interactive Assignment to "_"

2010-01-04 Thread Gabriel Genellina
En Fri, 01 Jan 2010 15:53:31 -0300, JKPeck escribió: On Jan 1, 10:06 am, Peter Otten <[email protected]> wrote: JKPeck wrote: > The gettext module uses the convention of defining a function named > "_" that maps text into its translation. > This conflicts with the automatic interactive interp

Re: TypeError: can only concatenate list (not "tuple") to list

2010-01-04 Thread David Williams
> Is there any reason for this error? Apart from "nobody cared to write the > code" > > py> [1,2,3] + (4,5) > Traceback (most recent call last): > File "", line 1, in > TypeError: can only concatenate list (not "tuple") to list > > In-place addition += does work: > > py> a = [1,2,3] > py> a

Re: python xmlrpc client with ssl client certificates and standard modules

2010-01-04 Thread mdipierro
xmlrpc acts at the application layer and ssl at the transport layer so they can inter operate easily as long as you do not use the certificate to authenticate the client but only validate the server and encrypt data (which you can also do but it is more complicated) One option for you is to use we

Re: TypeError: can only concatenate list (not "tuple") to list

2010-01-04 Thread Gabriel Genellina
En Mon, 04 Jan 2010 05:24:56 -0300, David Williams escribió: py> [1,2,3] + (4,5) Traceback (most recent call last): File "", line 1, in TypeError: can only concatenate list (not "tuple") to list In-place addition += does work: py> a = [1,2,3] py> a += (4,5) py> a [1, 2, 3, 4, 5] I g

Re: TypeError: can only concatenate list (not "tuple") to list

2010-01-04 Thread Gabriel Genellina
En Mon, 04 Jan 2010 05:22:44 -0300, Steven D'Aprano escribió: On Mon, 04 Jan 2010 04:59:02 -0300, Gabriel Genellina wrote: Is there any reason for this error? Apart from "nobody cared to write the code" Yes, because such implicit conversions would be a bad idea. I'm slowly convincing my

Re: python xmlrpc client with ssl client certificates and standard modules

2010-01-04 Thread News123
Thanks for your answer. I'll look at web2py. However web2py seems to address the xmlrpc server (at least in your example). The xmlrpc server application exists alerady and requires a client certificate. The client example doesn't seem to be using a certificate. So I'll be reading a little into

Re: TypeError: can only concatenate list (not "tuple") to list

2010-01-04 Thread Steven D'Aprano
On Mon, 04 Jan 2010 06:27:48 -0300, Gabriel Genellina wrote: > En Mon, 04 Jan 2010 05:24:56 -0300, David Williams > escribió: > >>> py> [1,2,3] + (4,5) >>> Traceback (most recent call last): >>> File "", line 1, in >>> TypeError: can only concatenate list (not "tuple") to list >>> >>> In-p

Re: twenty years ago Guido created Python

2010-01-04 Thread Ben Finney
Daniel Fetchinson writes: > Go, quick, these threads are all around us! They are popping up > everywhere! Go, go, quick! There is another troll thread right there! I wouldn't characterise this thread as a “troll thread”. If you think it is, that's fine I suppose. I'll continue to try improving

Re: ANN: Pymazon 0.1beta released.

2010-01-04 Thread Tim Wintle
On Tue, 2009-12-29 at 19:44 +0100, Chris Colbert wrote: > I'm happy to announce the first beta release of Pymazon: a Python > implemented alternative to the Amazon mp3 downloader. > > Pymazon was created specifically to alleviate the issues surrounding > the Linux version of the Amazon mp3 downlo

Best practices for simultaneously installed versioned packages?

2010-01-04 Thread Larry Hastings
I'm writing a package for Python 3--let's call it "spacegoblin". I fear someday I may need multiple versions installed and available simultaneously, even within one version of Python. So I want to plan ahead for that possibility. What would be the best way to allow this? Right now I install

Re: python mechanize proxy support question

2010-01-04 Thread elca
alex23 wrote: > > On Jan 4, 5:42 pm, elca wrote: >> how can i add proxy support into my mechanize script? >> i was look for some reference , but not so much good hint from google. > > There are examples on using proxies with mechanize on the module's > home page: > http://wwwsearch.sourceforg

Re: HAppy New Year

2010-01-04 Thread laiwei.ustc
HI Baboucarr good work beautiful thanks 2010-01-03 laiwei.ustc 发件人: baboucarr sanneh 发送时间: 2010-01-03 22:32:29 收件人: [email protected] 抄送: 主题: HAppy New Year Hi guys, Jus want to wish you a happy new year to u all.. 1.Copy the content below and Paste it on a Notepad. 2 .

How do you configure IDLE on a Mac, seeing as there's no Configure Option...

2010-01-04 Thread Mensanator
...because there's no [Options] menu on the shell window? Or at least give me a clue to how to use Courier New font? For some inscrutable reason, depite the plethora of formatting tools, someone decided that proportional spaced fonts ought to be the default for IDLE. -- http://mail.python.org/ma

Set variables based on dictionary

2010-01-04 Thread Joan Miller
How to set local variables based on dictionary contents? -- http://mail.python.org/mailman/listinfo/python-list

Re: twenty years ago Guido created Python

2010-01-04 Thread Steve Holden
Ben Finney wrote: > Daniel Fetchinson writes: > >> Go, quick, these threads are all around us! They are popping up >> everywhere! Go, go, quick! There is another troll thread right there! > > I wouldn't characterise this thread as a “troll thread”. If you think it > is, that's fine I suppose. >

Re: Question about an application

2010-01-04 Thread Steve Holden
rieh25 wrote: [top-posting corrected] >> On Jan 4, 2010, at 12:50 AM, rieh25 wrote: >> >>> I am thinking of installing a python webserver I coded in every >>> computer at >>> my work. This would allow me to run specific tasks in them, like >>> creating >>> backups, installing things, etc. Is

Re: Significant whitespace

2010-01-04 Thread Steve Holden
r0g wrote: > David Robinow wrote: >> On Sun, Jan 3, 2010 at 10:42 PM, Roy Smith wrote: >>> In article , >>> David Robinow wrote: >>> On Sun, Jan 3, 2010 at 8:09 PM, Tim Roberts wrote: > More than "not required", it was "not relevant". This led to one of the > most infamous program

Re: TypeError: can only concatenate list (not "tuple") to list

2010-01-04 Thread Jean-Michel Pichavant
Gabriel Genellina wrote: En Mon, 04 Jan 2010 05:24:56 -0300, David Williams escribió: py> [1,2,3] + (4,5) Traceback (most recent call last): File "", line 1, in TypeError: can only concatenate list (not "tuple") to list In-place addition += does work: py> a = [1,2,3] py> a += (4,5) py

Re: twenty years ago Guido created Python

2010-01-04 Thread Daniel Fetchinson
>>> Go, quick, these threads are all around us! They are popping up >>> everywhere! Go, go, quick! There is another troll thread right there! >> >> I wouldn't characterise this thread as a “troll thread”. If you think it >> is, that's fine I suppose. >> >> I'll continue to try improving the signal

Re: ANN: Pymazon 0.1beta released.

2010-01-04 Thread Chris Colbert
On Mon, Jan 4, 2010 at 11:43 AM, Tim Wintle wrote: > On Tue, 2009-12-29 at 19:44 +0100, Chris Colbert wrote: > > I'm happy to announce the first beta release of Pymazon: a Python > > implemented alternative to the Amazon mp3 downloader. > > > > Pymazon was created specifically to alleviate the iss

Re: python xmlrpc client with ssl client certificates and standard modules

2010-01-04 Thread mdipierro
If it is a client problem than web2py will be on help. If your server is written already you may be able to use it with the ssl cherrypy wsgi server (the one that web2py uses) and you do not need web2py at all. Massimo On Jan 4, 3:38 am, News123 wrote: > Thanks for your answer. > > I'll look at

Re: How do you configure IDLE on a Mac, seeing as there's no Configure Option...

2010-01-04 Thread Alf P. Steinbach
* Mensanator: ...because there's no [Options] menu on the shell window? Or at least give me a clue to how to use Courier New font? For some inscrutable reason, depite the plethora of formatting tools, someone decided that proportional spaced fonts ought to be the default for IDLE. Why not jus

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-04 Thread Nobody
On Sun, 03 Jan 2010 13:56:24 -0800, cassiope wrote: > I'm changing the uid and gid in the daemon (which runs with root > permissions > until the fork and uid/gid change). The uid and gid are confirmed by > printing os.getuid() and os.getgid() in the script. Those tell you the *real* UID/GID. Fil

Re: How do you configure IDLE on a Mac, seeing as there's no Configure Option...

2010-01-04 Thread Benjamin Kaplan
On Sun, Jan 3, 2010 at 8:42 PM, Mensanator wrote: > ...because there's no [Options] menu on the shell window? > > Or at least give me a clue to how to use Courier New font? > > For some inscrutable reason, depite the plethora of formatting tools, > someone decided that proportional spaced fonts ou

fsync() doesn't work as advertised?

2010-01-04 Thread Brian D
If I'm running a process in a loop that runs for a long time, I occasionally would like to look at a log to see how it's going. I know about the logging module, and may yet decide to use that. Still, I'm troubled by how fsync() doesn't seem to work as advertised: http://docs.python.org/library/o

Re: Best practices for simultaneously installed versioned packages?

2010-01-04 Thread Benjamin Kaplan
On Mon, Jan 4, 2010 at 6:09 AM, Larry Hastings wrote: > > I'm writing a package for Python 3--let's call it "spacegoblin". I fear > someday I may need multiple versions installed and available simultaneously, > even within one version of Python. So I want to plan ahead for that > possibility. W

Speeding up network access: threading?

2010-01-04 Thread Jens Müller
Hello, what would be best practise for speeding up a larger number of http-get requests done via urllib? Until now they are made in sequence, each request taking up to one second. The results must be merged into a list, while the original sequence needs not to be kept. I think speed could be

Re: fsync() doesn't work as advertised?

2010-01-04 Thread Antoine Pitrou
Le Mon, 04 Jan 2010 08:09:56 -0800, Brian D a écrit : > > What I've seen is that flush() alone produces a complete log when the > loop finishes. When I used fsync(), I lost all of the write entries > except the first, along with odd error trap and the last entry. Perhaps you are writing to the fi

Re: How do you configure IDLE on a Mac, seeing as there's no Configure Option...

2010-01-04 Thread Steve Holden
Alf P. Steinbach wrote: > * Mensanator: >> ...because there's no [Options] menu on the shell window? >> >> Or at least give me a clue to how to use Courier New font? >> >> For some inscrutable reason, depite the plethora of formatting tools, >> someone decided that proportional spaced fonts ought t

Re: Dynamic text color

2010-01-04 Thread John Posner
On Fri, 01 Jan 2010 21:01:04 -0500, Cousin Stanley wrote: I was not familiar with the re.finditer method for searching strings ... Stanley and Dave -- So far, we've just been using finditer() to perform standard-string searches (e.g. on the word "red"). Since Dave now wants to

Re: Speeding up network access: threading?

2010-01-04 Thread Terry Reedy
On 1/4/2010 11:22 AM, Jens Müller wrote: Hello, what would be best practise for speeding up a larger number of http-get requests done via urllib? Until now they are made in sequence, each request taking up to one second. The results must be merged into a list, while the original sequence needs n

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-04 Thread cassiope
On Jan 4, 7:46 am, Nobody wrote: > On Sun, 03 Jan 2010 13:56:24 -0800, cassiope wrote: > > I'm changing the uid and gid in the daemon (which runs with root > > permissions > > until the fork and uid/gid change).  The uid and gid are confirmed by > > printing os.getuid() and os.getgid() in the scri

No module named _socket, on windows

2010-01-04 Thread louisJ
Hi I installed python 2.6 (from python.org) for windows XP, and then Pylab. When I type "import pylab" in a python shell it shows the error: ImportError: No module named _socket Any idea what can I do to make this work? thank you -- http://mail.python.org/mailman/listinfo/python-list

Can't Add Variable

2010-01-04 Thread Victor Subervi
Hi; I have this code snippet: sql '''create table if not exists %sCustomerData ( ID tinyint(8) unsigned primary key auto_increment, Email varchar(120) not null, PhoneNumber varchar(20) not null, BillingName varchar(80) not null, BillingAddress1 varchar(100) not nu

Re: How to validate the __init__ parameters

2010-01-04 Thread Albert van der Horst
In article , Steve Holden wrote: > >What's the exact reason for requiring that a creator argument be of a >specific type? So operations on the instances don't go wrong? Well, why >not just admit that we don't have control over everything, and just *let >things go wrong* when the wrong type is pa

Re: Can't Add Variable

2010-01-04 Thread Joe Riopel
On Mon, Jan 4, 2010 at 12:28 PM, Victor Subervi wrote: > Hi; > I have this code snippet: > >     sql '''create table if not exists %sCustomerData ( I think you may have forgotten the "=" after sql. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't Add Variable

2010-01-04 Thread Stephen Hansen
On Mon, Jan 4, 2010 at 9:28 AM, Victor Subervi wrote: > Hi; > I have this code snippet: > > sql '''create table if not exists %sCustomerData ( > You left out the actual assignment operator. --S -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't Add Variable

2010-01-04 Thread Chris Rebert
On Mon, Jan 4, 2010 at 9:28 AM, Victor Subervi wrote: > Hi; > I have this code snippet: > >     sql '''create table if not exists %sCustomerData ( You're missing an equal sign there to start with (i.e. sql = '''). Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listi

Re: How to validate the __init__ parameters

2010-01-04 Thread Chris Rebert
On Mon, Jan 4, 2010 at 10:17 AM, Albert van der Horst wrote: > This triggers a question: I can see the traceback, but it > would be much more valuable, if I could see the arguments > passed to the functions. Is there a tool? print(locals()) #this actually gives the bindings for the entire local

Re: Can't Add Variable

2010-01-04 Thread MRAB
Victor Subervi wrote: Hi; I have this code snippet: sql '''create table if not exists %sCustomerData ( ID tinyint(8) unsigned primary key auto_increment, Email varchar(120) not null, PhoneNumber varchar(20) not null, BillingName varchar(80) not null, BillingAddr

asyncore based port splitter code questions

2010-01-04 Thread George Trojan
The following code is a attempt at port splitter: I want to forward data coming on tcp connection to several host/port addresses. It sort of works, but I am not happy with it. asyncore based code is supposed to be simple, but I need while loops and a lot of try/except clauses. Also, I had to ad

Re: Can't Add Variable

2010-01-04 Thread Victor Subervi
On Mon, Jan 4, 2010 at 1:42 PM, Chris Rebert wrote: > On Mon, Jan 4, 2010 at 9:28 AM, Victor Subervi > wrote: > > Hi; > > I have this code snippet: > > > > sql '''create table if not exists %sCustomerData ( > > You're missing an equal sign there to start with (i.e. sql = '''). > LOL. I thin

Re: fsync() doesn't work as advertised?

2010-01-04 Thread Brian D
On Jan 4, 10:29 am, Antoine Pitrou wrote: > Le Mon, 04 Jan 2010 08:09:56 -0800, Brian D a écrit : > > > > > What I've seen is that flush() alone produces a complete log when the > > loop finishes. When I used fsync(), I lost all of the write entries > > except the first, along with odd error trap

Re: How to validate the __init__ parameters

2010-01-04 Thread Phlip
Steve Holden wrote: What's the exact reason for requiring that a creator argument be of a specific type? So operations on the instances don't go wrong? Well, why not just admit that we don't have control over everything, and just *let things go wrong* when the wrong type is passed? Because s

Re: No module named _socket, on windows

2010-01-04 Thread Gabriel Genellina
En Mon, 04 Jan 2010 14:24:22 -0300, louisJ escribió: I installed python 2.6 (from python.org) for windows XP, and then Pylab. When I type "import pylab" in a python shell it shows the error: ImportError: No module named _socket Open the Python command line, type the following lines, and tell

Re: How to validate the __init__ parameters

2010-01-04 Thread Gabriel Genellina
En Mon, 04 Jan 2010 15:17:04 -0300, Albert van der Horst escribió: This triggers a question: I can see the traceback, but it would be much more valuable, if I could see the arguments passed to the functions. Is there a tool? Yes, the cgitb module [1]. Despite its name it's a general purpose

Where's a DOM builder that uses the Builder Pattern to ... build DOMs?

2010-01-04 Thread Phlip
Not Hyp: I hope I'm wrong, but seems that DOMBuilder, found among the various xml.dom packages, cannot build DOM like this: var html = DomBuilder.apply(); var form = html.FORM( html.DIV( html.INPUT({type : 'text', name : 'email'}), html.INPUT({type : 'text', name : 'password'}),

Re: How do you configure IDLE on a Mac, seeing as there's no Configure Option...

2010-01-04 Thread Ned Deily
In article , Benjamin Kaplan wrote: > On Sun, Jan 3, 2010 at 8:42 PM, Mensanator wrote: > > ...because there's no [Options] menu on the shell window? > > > > Or at least give me a clue to how to use Courier New font? > > > > For some inscrutable reason, depite the plethora of formatting tools,

Re: Best practices for simultaneously installed versioned packages?

2010-01-04 Thread Ned Deily
In article , Benjamin Kaplan wrote: > On Mon, Jan 4, 2010 at 6:09 AM, Larry Hastings wrote: > > I'm writing a package for Python 3--let's call it "spacegoblin". I fear > > someday I may need multiple versions installed and available simultaneously, > > even within one version of Python. So I

Premature End Of Script Headers

2010-01-04 Thread Victor Subervi
Hi; Here's my entire test script: #!/usr/bin/python def myMail(): print 'Content-type: text/html' print print ''' ''' Here's the error: [Mon Jan 04 12:59:15 2010] [error] [client 66.82.9.61] Premature end of script headers: mail.py, referer: http://angrynates.com/cart/cart2.py [r.

Re: twenty years ago Guido created Python

2010-01-04 Thread Ben Finney
Daniel Fetchinson writes: > But Ben will not get the Best Sense of Humor Award of 2010 for sure :) Sometimes the failing of humour is not with the recipient. -- \“Are you pondering what I'm pondering, Pinky?” “Sure, Brain, | `\ but how are we going to find chaps our size?” —_Pin

Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
I have a class of let's say empty bottle which can have a mix of two items. I want to create let's say 30 of these objects which will have names based on the 2 attributes (apple juice, beer, grape juice, beer, etc) that I provide from a list. All the objects are a mix of (1 of three alcohols) and (

Re: python xmlrpc client with ssl client certificates and standard modules

2010-01-04 Thread News123
Hi Massimo, I'm still a litle confused: My setup: server host: apache, php with an xmlrpc server interface. no python installed. multiple client hosts (linux / windows only default python installed) --- an existi

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Shawn Milochik
You could put them in a dictionary with the key being the name, instead of a list. Shawn -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception as the primary error handling mechanism?

2010-01-04 Thread Michi
On Jan 4, 1:30 pm, Steven D'Aprano wrote: > > This is very true, but good APIs often trade-off increased usability and > reduced defect rate against machine efficiency too. In fact, I would > argue that this is a general design principle of programming languages: > since correctness and programmer

Re: No module named _socket, on windows

2010-01-04 Thread louisJ
I don't know what happened or what I did in the meantime but it works now...no more errors. Gabriel, for information now I have: >>> import socket >>> socket._socket Thank you anyway. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Chris Rebert
On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote: > You could put them in a dictionary with the key being the name, instead of a > list. To illustrate that for the OP: name2drink = {} for booze in liquors: for juice in juices: name = juice +" "+booze # or however you're naming t

Re: How to validate the __init__ parameters

2010-01-04 Thread Albert van der Horst
In article , Chris Rebert wrote: >On Mon, Jan 4, 2010 at 10:17 AM, Albert van der Horst > wrote: > >> This triggers a question: I can see the traceback, but it >> would be much more valuable, if I could see the arguments >> passed to the functions. Is there a tool? > >print(locals()) #this actual

Efficiently determine where documents differ

2010-01-04 Thread Richard
Hello, I have been using the difflib library to find where 2 large HTML documents differ. The Differ().compare() method does this, but it is very slow - atleast 100x slower than the unix diff command. How can I efficiently determine where 2 documents differ in Python? (Ideally I am after the posi

Re: python xmlrpc client with ssl client certificates and standard modules

2010-01-04 Thread Martin v. Loewis
> I can do xmlrpc over ssl WITHOUT certificates with following code: > > import xmlrpclib > server_url = 'https://myserver' > server = xmlrpclib.Server(server_url); > > > and I can perform a https get request WITH certificates with below snippet: > > import httplib > conn = httplib.HTTPSConnect

Re: twenty years ago Guido created Python

2010-01-04 Thread n00m
Ben, go away from here. With all your stupids sigs. Do you think are you original? You are a stupid animal. Guido, Tim Peters, Raymond Hettinger are geniuis. I don't know exactly Python mob. Maybe forgot someone. You is only a source of depspise for them You get your everymonth fucking 1000 e sitti

FileInput too slow

2010-01-04 Thread wiso
I'm trying the fileinput module, and I like it, but I don't understand why it's so slow... look: from time import time from fileinput import FileInput file = ['r1_200907.log', 'r1_200908.log', 'r1_200909.log', 'r1_200910.log', 'r1_200911.log'] def f1(): n = 0 for f in file: print "new

Re: Efficiently determine where documents differ

2010-01-04 Thread Gabriel Genellina
En Mon, 04 Jan 2010 19:04:12 -0300, Richard escribió: I have been using the difflib library to find where 2 large HTML documents differ. The Differ().compare() method does this, but it is very slow - atleast 100x slower than the unix diff command. Differ compares sequences of lines *and* line

Re: Premature End Of Script Headers

2010-01-04 Thread Steve Holden
Victor Subervi wrote: > Hi; > > Here's my entire test script: > > #!/usr/bin/python > > def myMail(): > print 'Content-type: text/html' > print > print ''' > > > > > > > ''' > > Here's the error: > > [Mon Jan 04 12:59:15 2010] [error] [client 66.82.9.61] Premature end of > script h

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Jan Kaliszewski
2010-01-04, 22:54:41 Chris Rebert wrote: name2drink = {} for booze in liquors: for juice in juices: name = juice +" "+booze # or however you're naming them drink = Bottle(booze, juice) name2drink[name] = drink @Nav: ...and if you really desire to have those objects

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
On Jan 4, 4:54 pm, Chris Rebert wrote: > On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote: > > You could put them in a dictionary with the key being the name, instead of > > a list. > > To illustrate that for the OP: > > name2drink = {} > for booze in liquors: >     for juice in juices: >  

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Shawn Milochik
On Jan 4, 2010, at 5:59 PM, Nav wrote: > On Jan 4, 4:54 pm, Chris Rebert wrote: >> On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote: >>> You could put them in a dictionary with the key being the name, instead of >>> a list. >> >> To illustrate that for the OP: >> >> name2drink = {} >> fo

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Steve Holden
Nav wrote: > On Jan 4, 4:54 pm, Chris Rebert wrote: >> On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote: >>> You could put them in a dictionary with the key being the name, instead of >>> a list. >> To illustrate that for the OP: >> >> name2drink = {} >> for booze in liquors: >> for juic

Re: Exception as the primary error handling mechanism?

2010-01-04 Thread MRAB
Michi wrote: On Jan 4, 1:30 pm, Steven D'Aprano wrote: [snip] * Is it appropriate to force the caller to deal with the condition in a catch-handler? * If the caller fails to explicitly deal with the condition, is it appropriate to terminate the program? Only if the answer to these questions

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Nav
Thanks Jan, You read my mind. That is exactly what I needed. Thanks for showing the product function from itertools as well. It seems easier to grasp than the nested loops, I had been using. I noticed chopin.edu.pl. Are you a musician? Nav -- http://mail.python.org/mailman/listinfo/python-list

Re: Safe file I/O to shared file (or SQLite) from multi-threaded web server

2010-01-04 Thread Diez B. Roggisch
Lawrence D'Oliveiro schrieb: In message , Steve Holden wrote: Yes, but not to MySQL, please. Particularly since there is a sword of Damocles hanging over its head while the Oracle takeover of Sun is pending. Ah, I see the FUDsters are crawling out of the woodwork here, as well. I’ve got new

Re: twenty years ago Guido created Python

2010-01-04 Thread Mensanator
On Jan 4, 4:20 pm, n00m wrote: > Ben, go away from here. With all your stupids sigs. > Do you think are you original? > You are a stupid animal. > Guido, Tim Peters, Raymond Hettinger are geniuis. > I don't know exactly Python mob. Maybe forgot someone. > You is only a source of depspise for them

Re: Exception as the primary error handling mechanism?

2010-01-04 Thread Steven D'Aprano
On Mon, 04 Jan 2010 13:34:34 -0800, Michi wrote: > On Jan 4, 1:30 pm, Steven D'Aprano > wrote: >> >> This is very true, but good APIs often trade-off increased usability >> and reduced defect rate against machine efficiency too. In fact, I >> would argue that this is a general design principle of

Printing plain text with exact positioning on Windows

2010-01-04 Thread KvS
Dear all, for a python program running on Win XP that is used to produce invoices I need to be able to have the printer print a page with just plain text, but positioned (almost) exactly at prescribed places (due to the use of 'pre formatted' invoice forms). In particular as close to the left and

Re: Printing plain text with exact positioning on Windows

2010-01-04 Thread KvS
On Jan 4, 11:58 pm, "alejandro" wrote: > I think the easyest way for printing text is with ReportLab. Just few lines > of code and you have a nice pdf... Ok, thanks. In that scenario I would also need to be able to programatically adjust the printing margins in Acrobat reader, i.e. automate it to

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-04 Thread Cameron Simpson
On 04Jan2010 09:16, cassiope wrote: | To Cameron: the file doesn't (yet) exist; and it has the correct full | path. Can you show us the strace output of the failing open() call? | To "Nobody" : hey, this seems interesting. First test, invoking | seteuid() | and setegid() didn't help - but stran

Re: TypeError: can only concatenate list (not "tuple") to list

2010-01-04 Thread r0g
Gabriel Genellina wrote: > En Mon, 04 Jan 2010 04:58:54 -0300, Chris Rebert > escribió: >> On Sun, Jan 3, 2010 at 11:51 PM, Gabriel Genellina >> wrote: > >>> py> [1,2,3] + (4,5) >>> Traceback (most recent call last): >>> File "", line 1, in >>> TypeError: can only concatenate list (not "tuple"

Re: FileInput too slow

2010-01-04 Thread Gabriel Genellina
En Mon, 04 Jan 2010 19:35:02 -0300, wiso escribió: I'm trying the fileinput module, and I like it, but I don't understand why it's so slow... look: from time import time from fileinput import FileInput file = ['r1_200907.log', 'r1_200908.log', 'r1_200909.log', 'r1_200910.log', 'r1_200911

Re: Printing plain text with exact positioning on Windows

2010-01-04 Thread alejandro
Don't remember much.. but maybe you could play with canvas? I think i don't undertand(i am a croatian so english is not my mother language). If you have the need that the pdf and the printer setup have lets say the same paper size, sorry but can't help. If you want lets say different printer marg

mechanize module problem

2010-01-04 Thread alejandro
When I inport it wia python command line it all looks fine but if i try to run it from eclipse it gives me an error that there is no package mechanize. Have anybody had this situation? win XP python26 -- http://mail.python.org/mailman/listinfo/python-list

Re: mechanize module problem

2010-01-04 Thread alejandro
resolved! don't know why or how but it is... just restared eclipse for the fourth time "alejandro" wrote in message news:[email protected]... > When I inport it wia python command line it all looks fine but if i try to > run it from eclipse it gives me an error that there is no packag

Re: python mechanize proxy support question

2010-01-04 Thread alex23
On Jan 4, 9:25 pm, elca wrote: > that is only support mechanize.browser module.. actually > im looking mechanize.urlopen method. >From the docs: In these examples, the workings are hidden inside the mechanize.urlopen () function, which is an extension of urllib2.urlopen(). Redirects, proxies and

Re: Design question about pretree classifier

2010-01-04 Thread Aahz
In article , Steve Holden wrote: >Julian wrote: >> >> But: >> >> - none classification: return an exception or None? I think None is >> better, hence its not an exception that there is no classification but >> a defined state. What do you think? >> - many classifications: what to do? retun a se

Re: Using PyImport_ExtendInittab with package

2010-01-04 Thread Aahz
In article , Julien Danjou wrote: > >I'm trying to embed Python and therefore use PyImport_ExtendInittab() to >register modules. >My current problem is that, if it works well with a simple module >"hello", naming a module "hello.foobar" in the inittab struct does not >seems to work. >imp.find_mod

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread alex23
On Jan 5, 9:33 am, Nav wrote: > what are the risks of globalnamespace use You're unnecessarily tying your code to the implementation. > and what are the benefits? Absolutely none that using a dictionary doesn't also give you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing plain text with exact positioning on Windows

2010-01-04 Thread KvS
On Jan 5, 1:01 am, "alejandro" wrote: > Don't remember much.. but maybe you could play with canvas? > I think i don't undertand(i am a croatian so english is not my mother > language). If you have the need that the pdf and the printer setup have lets > say the same paper size, sorry but can't help

Off Topic ( was Re: Significant whitespace)

2010-01-04 Thread r0g
Steve Holden wrote: > r0g wrote: >> David Robinow wrote: >>> On Sun, Jan 3, 2010 at 10:42 PM, Roy Smith wrote: In article , David Robinow wrote: > On Sun, Jan 3, 2010 at 8:09 PM, Tim Roberts wrote: >> More than "not required", it was "not relevant". This led to one of th

Re: Can't Add Variable

2010-01-04 Thread alex23
On Jan 5, 3:40 am, Joe Riopel wrote: > On Mon, Jan 4, 2010 at 12:28 PM, Victor Subervi > wrote: > > Hi; > > I have this code snippet: > > >     sql '''create table if not exists %sCustomerData ( > > I think you may have forgotten the "=" after sql. Jesus wept. How long is this list going to con

Re: Can't Add Variable

2010-01-04 Thread MRAB
alex23 wrote: On Jan 5, 3:40 am, Joe Riopel wrote: On Mon, Jan 4, 2010 at 12:28 PM, Victor Subervi wrote: Hi; I have this code snippet: sql '''create table if not exists %sCustomerData ( I think you may have forgotten the "=" after sql. Jesus wept. How long is this list going to contin

Re: Exception as the primary error handling mechanism?

2010-01-04 Thread r0g
Michi wrote: > On Jan 4, 1:30 pm, Steven D'Aprano > wrote: >> In some, limited, cases you might be able to use the magic return value >> strategy, but this invariably leads to lost programmer productivity, more >> complex code, lowered readability and usability, and more defects, >> because progr

Re: TypeError: can only concatenate list (not "tuple") to list

2010-01-04 Thread Steven D'Aprano
On Tue, 05 Jan 2010 00:52:56 +, r0g wrote: > I'd be strongly inclined to think the result would be the sequence on > the left with the data from the second sequence appended to it. What's > wrong with a little duck typing here eh? That's not the existing behaviour. List concatenation doesn't

Re: TypeError: can only concatenate list (not "tuple") to list

2010-01-04 Thread r0g
Steven D'Aprano wrote: > On Tue, 05 Jan 2010 00:52:56 +, r0g wrote: > >> I'd be strongly inclined to think the result would be the sequence on >> the left with the data from the second sequence appended to it. What's >> wrong with a little duck typing here eh? OK, I hadn't read all the other

  1   2   >