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 gagsl-...@yahoo.com.ar wrote: This py [1,2,3] + (4,5) Traceback (most recent call last):  File stdin, line 1, in module TypeError: can only concatenate list (not tuple) to list Given that tuples are sometimes used as a poor man's object

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 stdin, line 1, in module 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,

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 (most

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 c...@rebertia.com escribió: On Sun, Jan 3, 2010 at 11:51 PM, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: py [1,2,3] + (4,5) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate list (not tuple)

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: dotanco...@gmail.com To: st...@holdenweb.com CC: python-list@python.org What

Re: python mechanize proxy support question

2010-01-04 Thread alex23
On Jan 4, 5:42 pm, elca high...@gmail.com 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/

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 stdin, line 1, in module TypeError: can only concatenate list (not tuple) to list In-place addition += does work: py a = [1,2,3] py a += (4,5)

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,

Re: How to Suppress Interactive Assignment to _

2010-01-04 Thread Gabriel Genellina
En Fri, 01 Jan 2010 15:53:31 -0300, JKPeck jkp...@gmail.com escribió: On Jan 1, 10:06 am, Peter Otten __pete...@web.de 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

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 stdin, line 1, in module TypeError: can only concatenate list (not tuple) to list In-place addition += does work: py a = [1,2,3] py a += (4,5)

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

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 da...@bibliolabs.com escribió: py [1,2,3] + (4,5) Traceback (most recent call last): File stdin, line 1, in module 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: 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 ste...@remove.this.cybersource.com.au 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

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

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 da...@bibliolabs.com escribió: py [1,2,3] + (4,5) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate list (not tuple) to list

Re: twenty years ago Guido created Python

2010-01-04 Thread Ben Finney
Daniel Fetchinson fetchin...@googlemail.com 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

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 downloader

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 high...@gmail.com 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:

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 收件人: python-list@python.org 抄送: 主题: 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. --

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 fetchin...@googlemail.com 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

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 robertoedw...@gmail.com 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,

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 r...@panix.com wrote: In article mailman.386.1262576043.28905.python-l...@python.org, David Robinow drobi...@gmail.com wrote: On Sun, Jan 3, 2010 at 8:09 PM, Tim Roberts t...@probo.com wrote: More than not required,

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 da...@bibliolabs.com escribió: py [1,2,3] + (4,5) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate list (not tuple) to list In-place addition += does work: py a =

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 to noise ratio

Re: ANN: Pymazon 0.1beta released.

2010-01-04 Thread Chris Colbert
On Mon, Jan 4, 2010 at 11:43 AM, Tim Wintle tim.win...@teamrubber.comwrote: 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

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 news...@free.fr wrote: Thanks for your answer.

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

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.

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 mensana...@aol.com 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

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:

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 la...@hastings.org 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

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

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 file

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 to be the

Re: Dynamic text color

2010-01-04 Thread John Posner
On Fri, 01 Jan 2010 21:01:04 -0500, Cousin Stanley cousinstan...@gmail.com wrote: snip 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

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

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

2010-01-04 Thread cassiope
On Jan 4, 7:46 am, Nobody nob...@nowhere.com 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()

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

Re: How to validate the __init__ parameters

2010-01-04 Thread Albert van der Horst
In article mailman.2271.1261450134.2873.python-l...@python.org, Steve Holden st...@holdenweb.com wrote: SNIP 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

Re: Can't Add Variable

2010-01-04 Thread Joe Riopel
On Mon, Jan 4, 2010 at 12:28 PM, Victor Subervi victorsube...@gmail.com 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 victorsube...@gmail.comwrote: 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 victorsube...@gmail.com 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 --

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 alb...@spenarnc.xs4all.nl wrote: snip 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

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,

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

Re: Can't Add Variable

2010-01-04 Thread Victor Subervi
On Mon, Jan 4, 2010 at 1:42 PM, Chris Rebert c...@rebertia.com wrote: On Mon, Jan 4, 2010 at 9:28 AM, Victor Subervi victorsube...@gmail.com wrote: Hi; I have this code snippet: sql '''create table if not exists %sCustomerData ( You're missing an equal sign there to start with

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

2010-01-04 Thread Brian D
On Jan 4, 10:29 am, Antoine Pitrou solip...@pitrou.net 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

Re: How to validate the __init__ parameters

2010-01-04 Thread Phlip
Steve Holden st...@holdenweb.com 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

Re: No module named _socket, on windows

2010-01-04 Thread Gabriel Genellina
En Mon, 04 Jan 2010 14:24:22 -0300, louisJ louisr...@gmail.com 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

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 alb...@spenarnc.xs4all.nl 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

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 ec96e1391001040805j13b4e5cet3f1b74e9a81ed...@mail.gmail.com, Benjamin Kaplan benjamin.kap...@case.edu wrote: On Sun, Jan 3, 2010 at 8:42 PM, Mensanator mensana...@aol.com wrote: ...because there's no [Options] menu on the shell window? Or at least give me a clue to how to use

Re: Best practices for simultaneously installed versioned packages?

2010-01-04 Thread Ned Deily
In article ec96e1391001040816r77970e4ekca36f43b19e40...@mail.gmail.com, Benjamin Kaplan benjamin.kap...@case.edu wrote: On Mon, Jan 4, 2010 at 6:09 AM, Larry Hastings la...@hastings.org wrote: I'm writing a package for Python 3--let's call it spacegoblin. I fear someday I may need multiple

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 ''' !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head title/title link rel=stylesheet type=text/css href=../../css/style.css /head body''' Here's the error:

Re: twenty years ago Guido created Python

2010-01-04 Thread Ben Finney
Daniel Fetchinson fetchin...@googlemail.com 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

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

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 ste...@remove.this.cybersource.com.au 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:

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 module '_socket' from 'C:\Python26\DLLs\_socket.pyd' 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 sh...@milochik.com 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

Re: How to validate the __init__ parameters

2010-01-04 Thread Albert van der Horst
In article mailman.423.1262627230.28905.python-l...@python.org, Chris Rebert c...@rebertia.com wrote: On Mon, Jan 4, 2010 at 10:17 AM, Albert van der Horst alb...@spenarnc.xs4all.nl wrote: snip This triggers a question: I can see the traceback, but it would be much more valuable, if I could see

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

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.HTTPSConnection(

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

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 richar...@gmail.com 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

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 ''' !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head title/title link rel=stylesheet type=text/css

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 c...@rebertia.com 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

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

2010-01-04 Thread Nav
On Jan 4, 4:54 pm, Chris Rebert c...@rebertia.com wrote: On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik sh...@milochik.com 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:    

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 c...@rebertia.com wrote: On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik sh...@milochik.com wrote: You could put them in a dictionary with the key being the name, instead of a list. To illustrate that for the OP:

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 c...@rebertia.com wrote: On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik sh...@milochik.com 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

Re: Exception as the primary error handling mechanism?

2010-01-04 Thread MRAB
Michi wrote: On Jan 4, 1:30 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au 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?

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 mailman.367.1262529266.28905.python-l...@python.org, 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

Re: twenty years ago Guido created Python

2010-01-04 Thread Mensanator
On Jan 4, 4:20 pm, n00m n...@narod.ru 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

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 ste...@remove.this.cybersource.com.au 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

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 aleksanda...@brisiovonet.hr 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

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

2010-01-04 Thread Cameron Simpson
On 04Jan2010 09:16, cassiope f...@u.washington.edu 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()

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 c...@rebertia.com escribió: On Sun, Jan 3, 2010 at 11:51 PM, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: py [1,2,3] + (4,5) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only

Re: FileInput too slow

2010-01-04 Thread Gabriel Genellina
En Mon, 04 Jan 2010 19:35:02 -0300, wiso gtu2...@alice.it 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',

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

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 aleksanda...@brisiovonet.hr wrote in message news:hhu38i$h2...@ss408.t-com.hr... 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

Re: python mechanize proxy support question

2010-01-04 Thread alex23
On Jan 4, 9:25 pm, elca high...@gmail.com 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().

Re: Design question about pretree classifier

2010-01-04 Thread Aahz
In article mailman.2090.1261159213.2873.python-l...@python.org, Steve Holden st...@holdenweb.com 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

Re: Using PyImport_ExtendInittab with package

2010-01-04 Thread Aahz
In article mailman.2093.1261160638.2873.python-l...@python.org, Julien Danjou jul...@danjou.info 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

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

2010-01-04 Thread alex23
On Jan 5, 9:33 am, Nav navjotmu...@gmail.com 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. --

Re: Printing plain text with exact positioning on Windows

2010-01-04 Thread KvS
On Jan 5, 1:01 am, alejandro aleksanda...@brisiovonet.hr 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

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 r...@panix.com wrote: In article mailman.386.1262576043.28905.python-l...@python.org, David Robinow drobi...@gmail.com wrote: On Sun, Jan 3, 2010 at 8:09 PM, Tim Roberts t...@probo.com wrote:

Re: Can't Add Variable

2010-01-04 Thread alex23
On Jan 5, 3:40 am, Joe Riopel goo...@gmail.com wrote: On Mon, Jan 4, 2010 at 12:28 PM, Victor Subervi victorsube...@gmail.com 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

Re: Can't Add Variable

2010-01-04 Thread MRAB
alex23 wrote: On Jan 5, 3:40 am, Joe Riopel goo...@gmail.com wrote: On Mon, Jan 4, 2010 at 12:28 PM, Victor Subervi victorsube...@gmail.com 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.

Re: Exception as the primary error handling mechanism?

2010-01-04 Thread r0g
Michi wrote: On Jan 4, 1:30 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au 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

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   >