Re: Exception as the primary error handling mechanism?

2010-01-04 Thread Lie Ryan
On 1/5/2010 1:31 PM, r0g wrote: 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

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

2010-01-04 Thread Ned Deily
In article <0d70cb54-3d77-4176-b621-e764ecf61...@26g2000yqo.googlegroups.com>, Mensanator wrote: > I assume I've been using the IDLE from macports. From the command > prompt I've > been typing "idle". This launches a "shell" window which appears to > have an X11 > parent application for which th

Re: Best practices for simultaneously installed versioned packages?

2010-01-04 Thread Ned Deily
In article <4b42b45e.9070...@hastings.org>, Larry Hastings wrote: > Ned Deily wrote: > > Also, setuptools (and, its successor, distribute, which supports Python > > 3) allow the installation and management of multiple versions of a > > package within one python site-library instance. > That sou

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

2010-01-04 Thread Steven D'Aprano
On Mon, 04 Jan 2010 21:27:12 -0800, Nav wrote: > @ Steven > "No, you're confused -- the problem isn't with using the global > namespace. > The problem is that you don't know what names you want to use ahead of > time. " > > Actually I know what the names would be and how I want to use them.

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

2010-01-04 Thread Mensanator
On Jan 4, 9:17 am, "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 proport

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

2010-01-04 Thread Mensanator
On Jan 4, 10:44 pm, Mensanator wrote: > On Jan 4, 10:05 am, 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 inscrutab

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

2010-01-04 Thread cassiope
One more tidbit observed: my last note, that it works when using seteuid/setegid? Well - that only applies if the daemon is running under strace (!). It fails if started directly by root, or if the strace session has ended, leaving the main body of the daemon running in its normal headless manner.

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

2010-01-04 Thread Nav
"> if yes then: > if using globalnamespace is bad then why does every book or tutorial > about python classes give the above style of assignment as an > example? That's a basic assignment example. It's not a direct manipulation of globals(), like the solution given by Jan, which you seem to fee

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

2010-01-04 Thread Dave Angel
(You top-posted. It's polite on most newsgroups, and specifically on this one to add your comments *following* the quoted earlier text) Nav wrote: Okay, let me ask another question: When we create instances of objects by doing x = className () are we using globalnamespace? If that line ap

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

2010-01-04 Thread Mensanator
On Jan 4, 2:25 pm, Ned Deily wrote: > 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 r

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

2010-01-04 Thread cassiope
On Jan 4, 4:23 pm, Cameron Simpson wrote: > 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? Ah...presumably you mean: [pid 1976] open("/var/tmp/share/lvrq

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

2010-01-04 Thread Mensanator
On Jan 4, 10:05 am, 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: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread alex23
On Jan 5, 1:12 pm, Nav wrote: > When we create instances of objects by doing > x = className () > are we using globalnamespace? Well, you're using a namespace, which namespaces its in would depend on the scope in which that assignment occurred. And there's not really a global namespace, only modu

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

2010-01-04 Thread Steven D'Aprano
On Mon, 04 Jan 2010 19:12:53 -0800, Nav wrote: > Okay, let me ask another question: > > When we create instances of objects by doing > x = className() > are we using globalnamespace? That depends on whether you are doing x = className() inside a function (or class), or in the top level of the

Re: Best practices for simultaneously installed versioned packages?

2010-01-04 Thread Larry Hastings
In article , Benjamin Kaplan wrote: wxpython installs a "wxversion" module which has functions like getInstalled(), ensureMinimal(version), and select(version). You can call wxversion.select before importing wx and it will make sure that the correct version is imported. You might want to

Re: Printing plain text with exact positioning on Windows

2010-01-04 Thread alejandro
I think the easyest way for printing text is with ReportLab. Just few lines of code and you have a nice pdf... -- http://mail.python.org/mailman/listinfo/python-list

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

2010-01-04 Thread Nav
Thanks for pointing it out Steve. The blog post doesn't explain it very well. I understand the risk of exec or eval(input). but what are the risks of globalnamespace use and what are the benefits? -- http://mail.python.org/mailman/listinfo/python-list

Re: Speeding up network access: threading?

2010-01-04 Thread exarkun
On 04:22 pm, m...@privacy.net 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 no

Re: FileInput too slow

2010-01-04 Thread Terry Reedy
On 1/4/2010 5:35 PM, wiso wrote: 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 =

Re: FileInput too slow

2010-01-04 Thread Steven D'Aprano
On Mon, 04 Jan 2010 23:35:02 +0100, wiso wrote: > I'm trying the fileinput module, and I like it, but I don't understand > why it's so slow... Because it is written for convenience, not speed. From the source code: "Performance: this module is unfortunately one of the slower ways of processing

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

2010-01-04 Thread Nav
Okay, let me ask another question: When we create instances of objects by doing x = className () are we using globalnamespace? if yes then: if using globalnamespace is bad then why does every book or tutorial about python classes give the above style of assignment as an example? Second why do

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

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: 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: 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: 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

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: 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

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: 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: 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: 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: 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: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 that there is no packag

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: 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

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: 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: 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: 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

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: 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

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: 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: 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: 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 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: 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 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 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: 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: 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

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: 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

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

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: 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

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: 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: 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: 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: 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

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: 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

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: 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

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,

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

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 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: 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: 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

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

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 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: 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 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: 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

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

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

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

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: 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: 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: 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

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: 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

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: 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

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 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: 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: 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: 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: 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: 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: 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: 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. >

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

  1   2   >