Re: Class-level variables - a scoping issue

2010-10-11 Thread Lawrence D'Oliveiro
In message <8hfq23fet...@mid.individual.net>, Gregory Ewing wrote: > Lawrence D'Oliveiro wrote: > >> It seems to me the same principle, that of disallowing implicit >> overriding of a name from an outer scope with that from an inner one >> after the former has already been referenced, should be a

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-11 Thread Lawrence D'Oliveiro
In message , Ethan Furman wrote: > Lawrence D'Oliveiro wrote: > >> In message , Ethan >> Furman wrote: >> >>>Lawrence D'Oliveiro wrote: >>> But they can only recognize it as a BOM if they assume UTF-8 encoding to begin with. Otherwise it could be interpreted as some other coding. >>> >>>

Who is she?

2010-10-11 Thread nosrah
Lady Aisha (may Allah be pleased with her) is what this humanity possesses of bright mind, sharp wit, and abundant knowledge. Additionally, for her effective role in serving the Islamic thought through relating Prophet Muhammad's (PBUH) Hadiths (narrations); interpreting a lot of the aspects of the

Re: UTF-8 problem encoding and decoding in Python3

2010-10-11 Thread Almar Klein
On 10 October 2010 23:01, Hidura wrote: > I try to encode a binary file what was upload to a server and is > extract from the wsgi.input of the environ and comes as an unicode > string. > Firstly, UTF-8 is not meant to encode arbitrary binary data. But I guess you could have a Unicode string in

Re: [Python-ideas] [Python-Dev] Inclusive Range

2010-10-11 Thread Antoon Pardon
On Sat, Oct 09, 2010 at 01:37:03AM +, Steven D'Aprano wrote: > On Fri, 08 Oct 2010 15:53:17 -0400, Jed Smith wrote: > > > On Fri, Oct 8, 2010 at 1:26 PM, Steven D'Aprano > > wrote: > >> On Fri, 08 Oct 2010 10:21:16 +0200, Antoon Pardon wrote: > >> > >>> Personnaly I find it horrible > >>> tha

Difficulty in easy_install

2010-10-11 Thread sankalp srivastava
I am having difficulty in easy_installing I use a proxy server and strange errors , like it can't fetch the package is showing up . the package is pyspeech ...please help me :( I don't know if the proxy server is causing the problems , in linux i would have import http-proxy in .bashrc but am no

Re: cp936 uses gbk codec, doesn't decode `\x80` as U+20AC EURO SIGN

2010-10-11 Thread Ulrich Eckhardt
John Machin wrote: > |>>> '\x80'.decode('cp936') > Traceback (most recent call last): > File "", line 1, in > UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 > in position 0: incomplete multibyte sequence [...] > So Microsoft appears to think that > cp936 includes the euro, > and the ICU

Mother Aisha may Allah be pleased with her

2010-10-11 Thread Sons Aisha
Lady Aisha (may Allah be pleased with her) is what this humanity possesses of bright mind, sharp wit, and abundant knowledge. Additionally, for her effective role in serving the Islamic thought through relating Prophet Muhammad's (PBUH) Hadiths (narrations); interpreting a lot of the aspects of the

binary vtk file

2010-10-11 Thread Paul Biegel
Hi, I have a question related to read a binary vtk file. This file has been created using Matlab by the command "fread". However, this file must be processed further within Python. It is not known to me which codec is used to encode this file. It starts with the following characters: *1XùB4zBÑX•

Re: [Python-ideas] [Python-Dev] Inclusive Range

2010-10-11 Thread Dave Angel
On 2:59 PM, Antoon Pardon wrote: On Sat, Oct 09, 2010 at 01:37:03AM +, Steven D'Aprano wrote: But the point was that Antoon claimed that there is no numeric value for the end position that will include L[0] in the reversed slice. My example shows that this is not correct. I stand by that

ukhomemadescandals

2010-10-11 Thread sam
due to high pornography i have hidden the video in the website. left side below search box click the image and watch all video..http://ukhomemadescandals.tk/ -- http://mail.python.org/mailman/listinfo/python-list

Re: del() function - cannot find documentation

2010-10-11 Thread Lawrence D'Oliveiro
In message , mafeu...@gmail.com wrote: > the problem is I cannot find any information about del() function in > python 2.7 documentation. Try the Python language reference. -- http://mail.python.org/mailman/listinfo/python-list

Re: I don't get why sys.exit(1) doesn't exit the while loop in the follow case

2010-10-11 Thread Lawrence D'Oliveiro
In message , Nobody wrote: > If I'm catching exceptions in order to perform clean-up, I'll use a bare > except and re-raise the exception afterwards. In that situation, a bare > except is usually the right thing to do. Wrong way to do it. -- http://mail.python.org/mailman/listinfo/python-list

Re: help!!!

2010-10-11 Thread Lawrence D'Oliveiro
In message , Emile van Sebille wrote: > Oh come now -- isn't being lazy a primary programmer's attribute? I wonder if that’s why more men are good at it than women... -- http://mail.python.org/mailman/listinfo/python-list

Re: help!!!

2010-10-11 Thread Lawrence D'Oliveiro
In message , Seebs wrote: > ... but I wasn't aware that it had been deprecated, except in the sense of > being derided and dismissed as of no value. What more did you want? :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading Outlook .msg file using Python

2010-10-11 Thread Tim Golden
On 10/10/2010 22:51, John Henry wrote: I have a need to read .msg files exported from Outlook. Google search came out with a few very old posts about the topic but nothing really useful. The email module in Python is no help - everything comes back blank and it can't even see if there are attac

Re: del() function - cannot find documentation

2010-10-11 Thread Lawrence D'Oliveiro
In message , Tim Roberts wrote: > This kind of confusion is, in my opinion, the primary reason why > parentheses should never be used with "del" and "return", as we so > commonly see. It’s the kind of “confusion” that could be cleared up with 30 seconds’ access to a Python interpreter: l...

Re: Help with sets

2010-10-11 Thread Lawrence D'Oliveiro
In message <8h9ob9fku...@mid.individual.net>, Gregory Ewing wrote: > Lawrence D'Oliveiro wrote: > >> Did you know that applying the “set” or “frozenset” functions to a dict >> return a set of its keys? > >> Seems a bit dodgy, somehow. > > That's just a consequence of the fact that dicts produce

Re: [Python-ideas] [Python-Dev] Inclusive Range

2010-10-11 Thread Antoon Pardon
On Mon, Oct 11, 2010 at 06:25:49AM -0400, Dave Angel wrote: > On 2:59 PM, Antoon Pardon wrote: > >On Sat, Oct 09, 2010 at 01:37:03AM +, Steven D'Aprano wrote: > > > >>But the point was that Antoon claimed that there is no numeric value for > >>the end position that will include L[0] in the rev

Re: Many newbie questions regarding python

2010-10-11 Thread Jean-Michel Pichavant
Peter Pearson wrote: On Sat, 09 Oct 2010 19:30:16 -0700, Ethan Furman wrote: Steven D'Aprano wrote: [snip] But that doesn't mean that the list comp is the general purpose solution. Consider the obvious use of the idiom: def func(arg, count): # Initialise the list. L = [ar

EOF while scanning triple-quoted string literal

2010-10-11 Thread bussiere bussiere
i've looked on the web and here but i didn't find an answer : here is my code zlib.decompress(""" xワᆳヤ=ラᄇHナs~Ʀᄑç\ムîà z...@ÑÁÔqÇlxÇÆïpp~ývãì゙m6ÛÐ|ê֭ᄁᄂヤ=)}éÓUe﬿ö3ᄎᄌú"}ʿïÿ÷1þ8ñ́U÷ᄏñíLÒVi:`ᄈᄎL!Ê҆p6-%Fë^ヘ÷à,Q.K!ユô`ÄA!ÑêweÌ ÊÚAロYøøÂjôóᅠÂcñ䊧fᆴùテúN :nüzAÝ7%ᄌcdUタᄌ3ôPۂタlンyHᆲᄑ$/yzᄒíàヌ'ÕÓ&`|S!<'ᄂ÷Zļᄐ2ホモ;ニ(ÅÛf

Re: I don't get why sys.exit(1) doesn't exit the while loop in the follow case

2010-10-11 Thread Peter Otten
Steven D'Aprano wrote: > On Tue, 05 Oct 2010 13:57:11 +1100, Ben Finney wrote: > >> chad writes: >> >>> while 1: >> >> A minor point: this is more explanatory and less misleading if you write >> it as ‘while True’. > > Why is it misleading? Is there some circumstance in Python where the > lit

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-11 Thread Ethan Furman
Lawrence D'Oliveiro wrote: In message , Ethan Furman wrote: Lawrence D'Oliveiro wrote: In message , Ethan Furman wrote: Lawrence D'Oliveiro wrote: But they can only recognize it as a BOM if they assume UTF-8 encoding to begin with. Otherwise it could be interpreted as some other codi

Re: [Python-ideas] [Python-Dev] Inclusive Range

2010-10-11 Thread Ethan Furman
Antoon Pardon wrote: On Sat, Oct 09, 2010 at 01:37:03AM +, Steven D'Aprano wrote: On Fri, 08 Oct 2010 15:53:17 -0400, Jed Smith wrote: On Fri, Oct 8, 2010 at 1:26 PM, Steven D'Aprano wrote: On Fri, 08 Oct 2010 10:21:16 +0200, Antoon Pardon wrote: Personnaly I find it horrible that

Missing modules for python

2010-10-11 Thread Sunil Saggar
I was trying to make exe from python program and found the following errors The following modules appear to be missing ['email.FeedParser', 'email.Generator', 'email.Iterators', 'email.Message', 'email.Utils', 'simplejson', 'socks'] I am using Python 2.6 -- Regards Sunil Saggar -- http://mai

Re: I don't get why sys.exit(1) doesn't exit the while loop in the follow case

2010-10-11 Thread Ethan Furman
Lawrence D'Oliveiro wrote: In message , Nobody wrote: If I'm catching exceptions in order to perform clean-up, I'll use a bare except and re-raise the exception afterwards. In that situation, a bare except is usually the right thing to do. Wrong way to do it. What, then, is the right way to

Re: Help with sets

2010-10-11 Thread Ethan Furman
Lawrence D'Oliveiro wrote: In message <8h9ob9fku...@mid.individual.net>, Gregory Ewing wrote: Lawrence D'Oliveiro wrote: Did you know that applying the “set” or “frozenset” functions to a dict return a set of its keys? Seems a bit dodgy, somehow. That's just a consequence of the fact tha

emdding python gui in c code - OS independent

2010-10-11 Thread tinauser
hi there, i need to embed python GUI in a c++ code. I've seen that,while on windows running GUI is no problem, in mac i need to use pythonw instead python. the question is,how should i tell the program that if the OS is mac, it should pythonw, otherwise python is fine? -- http://mail.python.org/ma

Re: [Python-Dev] PyArg_ParseTuple

2010-10-11 Thread Brian Curtin
On Mon, Oct 11, 2010 at 07:06, Ioan Ferencik wrote: > I would like to ask where can I find more detailed info on > PyArg_ParseTuple function. > > I find the doc limited on the matter. > Mainly I am curious why the function requires an address of a pointer. > > I have issues in the following case

Re: Class-level variables - a scoping issue

2010-10-11 Thread Jean-Michel Pichavant
John Nagle wrote: Here's an obscure bit of Python semantics which is close to being a bug: >>> class t(object) : ... classvar = 1 ... ... def fn1(self) : ... print("fn1: classvar = %d" % (self.classvar,)) ... self.classvar = 2 ... print("fn1: classvar = %d" % (

Re: help!!!

2010-10-11 Thread Andreas Waldenburger
On Mon, 11 Oct 2010 23:51:46 +1300 Lawrence D'Oliveiro wrote: > In message , > Emile van Sebille wrote: > > > Oh come now -- isn't being lazy a primary programmer's attribute? > > I wonder if that’s why more men are good at it than women... You may want to think about whether this really was y

Re: help!!!

2010-10-11 Thread Jason Swails
On Mon, Oct 11, 2010 at 9:25 AM, Andreas Waldenburger wrote: > On Mon, 11 Oct 2010 23:51:46 +1300 Lawrence D'Oliveiro > wrote: > > > In message , > > Emile van Sebille wrote: > > > > > Oh come now -- isn't being lazy a primary programmer's attribute? > > > > I wonder if that’s why more men are g

Re: if the else short form

2010-10-11 Thread Neville Dempsey
On Oct 11, 11:46 am, Lawrence D'Oliveiro wrote: > Nowadays we take it for granted that the core language should be a strong > and compact basis to build on, rather than providing lots of built-in > features, and all the rest should come from run-time libraries. Fast forward to 1972... In 1972 Bri

Re: binary vtk file

2010-10-11 Thread Robert Kern
On 10/11/10 5:16 AM, Paul Biegel wrote: Hi, I have a question related to read a binary vtk file. This file has been created using Matlab by the command "fread". However, this file must be processed further within Python. It is not known to me which codec is used to encode this file. It starts wit

Re: Missing modules for python

2010-10-11 Thread Jed Smith
On Mon, Oct 11, 2010 at 8:43 AM, Sunil Saggar wrote: > I was trying to make exe from python program and found the following errors > > The following modules appear to be missing > ['email.FeedParser', 'email.Generator', 'email.Iterators', 'email.Message', > 'email.Utils', 'simplejson', 'socks'] >

Wingware Python IDE 3.2.11 released

2010-10-11 Thread Wingware
Hi, Wingware has released version 3.2.11 of Wing IDE, an integrated development environment designed specifically for the Python programming language. This release includes the following improvements: * Improved Perforce integration * Improved vi and Visual Studio modes, and keyboard navigation

Re: Can't find pythonwin

2010-10-11 Thread Jed Smith
On Mon, Oct 11, 2010 at 3:46 AM, Dennis Lee Bieber wrote: > On Sun, 10 Oct 2010 20:33:09 -0400, Jed Smith > declaimed the following in gmane.comp.python.general: > >> >> As far as I know, Pythonwin is a collection of extensions to Python >> that are available on Windows (and antiquated). >> >    

Re: Class-level variables - a scoping issue

2010-10-11 Thread John Posner
On 10/10/2010 7:02 PM, Steven D'Aprano wrote: On Sun, 10 Oct 2010 18:14:33 -0400, John Posner wrote: Class attributes are often used as "class constants", so how about naming them with UPPERCASE names, like other constants? When you choose to override one of these constants, like this: se

logging.handlers.SMTPHandler and fileConfig

2010-10-11 Thread pstatham
I'm trying to use pythons logging.handlers.SMTPHandler with a configuration file (so that I don't have to have passwords etc. inside of the script) Now the guide I'm following is [URL="http://docs.python.org/library/ logging.html#configuration-file-format"]here[/URL], now the RotatingFileHandler i

Adding to an Array inside a Dict

2010-10-11 Thread MacOSX @ Rocteur.cc
Hi, Is there an easier way to do this, I am adding/creating to an array inside a dict but can find a cleaner way: So I first check if the key exists already, if it does then I know I use append, if it does not I create it. if osmdict.has_key(token): osmdict[token]['user'].app

Re: Help with sets

2010-10-11 Thread Robert Kern
On 10/11/10 6:11 AM, Lawrence D'Oliveiro wrote: In message<8h9ob9fku...@mid.individual.net>, Gregory Ewing wrote: Lawrence D'Oliveiro wrote: Did you know that applying the “set” or “frozenset” functions to a dict return a set of its keys? Seems a bit dodgy, somehow. That's just a consequ

Re: help!!!

2010-10-11 Thread Robert Kern
On 10/11/10 8:44 AM, Jason Swails wrote: On Mon, Oct 11, 2010 at 9:25 AM, Andreas Waldenburger wrote: On Mon, 11 Oct 2010 23:51:46 +1300 Lawrence D'Oliveiro wrote: > In message mailto:mailman.1417.1286438621.29448.python-l...@python.org>>, > Emile van Sebille wrote: >

Re: Adding to an Array inside a Dict

2010-10-11 Thread Robert Kern
On 10/11/10 9:55 AM, MacOSX @ Rocteur.cc wrote: Hi, Is there an easier way to do this, I am adding/creating to an array inside a dict but can find a cleaner way: So I first check if the key exists already, if it does then I know I use append, if it does not I create it. if osmdict.has

Re: Reading Outlook .msg file using Python

2010-10-11 Thread John Henry
On Oct 11, 3:56 am, Tim Golden wrote: > On 10/10/2010 22:51, John Henry wrote: > > > I have a need to read .msg files exported from Outlook.  Google search > > came out with a few very old posts about the topic but nothing really > > useful.  The email module in Python is no help - everything come

Re: Reading Outlook .msg file using Python

2010-10-11 Thread Tim Golden
On 11/10/2010 4:39 PM, John Henry wrote: I am trying your code but when it get to the line: mapi.MAPIInitialize ((mapi.MAPI_INIT_VERSION, 0)) I got the error message: Either there is no default mail client or the current mail client cannot fulfill the messsage requrest. Please run Micr

Re: logging.handlers.SMTPHandler and fileConfig

2010-10-11 Thread Chris Rebert
On Mon, Oct 11, 2010 at 7:52 AM, pstatham wrote: > I'm trying to use pythons logging.handlers.SMTPHandler with a > configuration file (so that I don't have to have passwords etc. inside > of the script) > > Now the guide I'm following is [URL="http://docs.python.org/library/ > logging.html#configu

2D List

2010-10-11 Thread Fasihul Kabir
a = [0]*5 for i in range(0, 4): for j in range(0, i): a[i].append(j) why the above codes show the following error. and how to overcome it. Traceback (most recent call last): File "", line 3, in a[i].append(j) AttributeError: 'int' object has no attribute 'append' --

Re: 2D List

2010-10-11 Thread Nitin Pawar
the declaration is wrong if you want to create a two dimensional array try to use functions like arange and reshape On Mon, Oct 11, 2010 at 9:54 PM, Fasihul Kabir wrote: > a = [0]*5 > for i in range(0, 4): > for j in range(0, i): > a[i].append(j) > > why the above codes show the fo

Re: 2D List

2010-10-11 Thread Chris Rebert
On Mon, Oct 11, 2010 at 9:24 AM, Fasihul Kabir wrote: > a = [0]*5 >  for i in range(0, 4): >     for j in range(0, i): >         a[i].append(j) > > why the above codes show the following error. and how to overcome it. > > Traceback (most recent call last): >   File "", line 3, in >     a[i].appen

Re: help!!!

2010-10-11 Thread Jason Swails
On Mon, Oct 11, 2010 at 11:11 AM, Robert Kern wrote: > On 10/11/10 8:44 AM, Jason Swails wrote: > >> >> >> On Mon, Oct 11, 2010 at 9:25 AM, Andreas Waldenburger >> >> wrote: >> >>On Mon, 11 Oct 2010 23:51:46 +1300 Lawrence D'Oliveiro >> wrote: >> >> > In message >

Re: emdding python gui in c code - OS independent

2010-10-11 Thread Chris Rebert
On Mon, Oct 11, 2010 at 6:16 AM, tinauser wrote: > hi there, > i need to embed python GUI in a c++ code. I've seen that,while on > windows running GUI is no problem, in mac i need to use pythonw > instead python. > the question is,how should i tell the program that if the OS is mac, > it should py

Re: Many newbie questions regarding python

2010-10-11 Thread Peter Pearson
On Sun, 10 Oct 2010 18:36:27 -0700, Ethan Furman wrote: [snip] > > My question is more along the lines of: a mutable object was passed in > to func()... what style of loop could be used to turn that one object > into /n/ distinct objects? A list comp won't do it, but neither will a > for loop,

Re: Class-level variables - a scoping issue

2010-10-11 Thread Chris Rebert
On Mon, Oct 11, 2010 at 9:44 AM, Dennis Lee Bieber wrote: > On Mon, 11 Oct 2010 10:43:04 -0400, John Posner > declaimed the following in gmane.comp.python.general: >> No surprising behavior, just a surprising look: >> >>    self.EGGS = ... >> >> ... which might remind the programmer what's going

Re: 2D List

2010-10-11 Thread Gary Herron
On 10/11/2010 09:24 AM, Fasihul Kabir wrote: a = [0]*5 for i in range(0, 4): for j in range(0, i): a[i].append(j) why the above codes show the following error. and how to overcome it. Traceback (most recent call last): File "", line 3, in a[i].append(j) AttributeError: 'int'

Re: "Strong typing vs. strong testing"

2010-10-11 Thread Vic Kelson
On Sep 28, 10:55 am, Tim Bradshaw wrote: > There's a large existing body of knowledge on dimensional analysis > (it's a very important tool for physics, for instance), and obviously > the answer is to do whatever it does.  Raising to any power is fine, I > think (but transcendental functions, for

Re: emdding python gui in c code - OS independent

2010-10-11 Thread tinauser
On Oct 11, 6:49 pm, Chris Rebert wrote: > On Mon, Oct 11, 2010 at 6:16 AM, tinauser wrote: > > hi there, > > i need to embed python GUI in a c++ code. I've seen that,while on > > windows running GUI is no problem, in mac i need to use pythonw > > instead python. > > the question is,how should i t

"char buffer type not available" error while gunzip

2010-10-11 Thread Istvan Gouritz
Hello! I'm getting exception while trying to gunzip data, which is stored in db: File "helper.py", line 33, in gunzip f = StringIO(data) "exceptions.TypeError: char buffer type not available" function which does gunzipping: def gunzip(s): print type(data)) #print

Re: logging.handlers.SMTPHandler and fileConfig

2010-10-11 Thread Chris Withers
On 11/10/2010 15:52, pstatham wrote: I'm trying to use pythons logging.handlers.SMTPHandler with a configuration file (so that I don't have to have passwords etc. inside of the script) Use MailingLogger and ZConfig ;-) http://groups.google.com/group/simplistix/browse_thread/thread/f4223c3a92e9

How is correct use of eval()

2010-10-11 Thread Cata
Hi . I read about eval(). I also read about this "bug" : cod = raw_input ('Enter:") eval (cod) if i use "rm -rf ~" all files will be deleted . What is correct way to use this function? Thank's -- http://mail.python.org/mailman/listinfo/python-list

Re: How is correct use of eval()

2010-10-11 Thread Chris Rebert
On Mon, Oct 11, 2010 at 11:11 AM, Cata wrote: > Hi . > I read about eval(). > I also read about this "bug" : > cod = raw_input ('Enter:") > eval (cod) > if i use  "rm -rf ~"  all files will be deleted . That's incorrect. eval() does not (directly) run shell commands. It does evaluate arbitrary Py

Re: Adding to an Array inside a Dict

2010-10-11 Thread MRAB
On 11/10/2010 15:55, MacOSX @ Rocteur.cc wrote: Hi, Is there an easier way to do this, I am adding/creating to an array inside a dict but can find a cleaner way: So I first check if the key exists already, if it does then I know I use append, if it does not I create it. if osmdict.has

Re: emdding python gui in c code - OS independent

2010-10-11 Thread Diez B. Roggisch
tinauser writes: > On Oct 11, 6:49 pm, Chris Rebert wrote: >> On Mon, Oct 11, 2010 at 6:16 AM, tinauser wrote: >> > hi there, >> > i need to embed python GUI in a c++ code. I've seen that,while on >> > windows running GUI is no problem, in mac i need to use pythonw >> > instead python. >> > the

Re: help!!!

2010-10-11 Thread Robert Kern
On 10/11/10 11:44 AM, Jason Swails wrote: On Mon, Oct 11, 2010 at 11:11 AM, Robert Kern mailto:robert.k...@gmail.com>> wrote: On 10/11/10 8:44 AM, Jason Swails wrote: On Mon, Oct 11, 2010 at 9:25 AM, Andreas Waldenburger wrote: On Mon, 11 Oct 2010 2

Re: How is correct use of eval()

2010-10-11 Thread Robert Kern
On 10/11/10 1:11 PM, Cata wrote: Hi . I read about eval(). I also read about this "bug" : cod = raw_input ('Enter:") eval (cod) if i use "rm -rf ~" all files will be deleted . What is correct way to use this function? There are cases when you are writing meta-programming tools for programmer

Re: help!!!

2010-10-11 Thread Jason Swails
On Mon, Oct 11, 2010 at 3:05 PM, Robert Kern wrote: > On 10/11/10 11:44 AM, Jason Swails wrote: > >> >> >> On Mon, Oct 11, 2010 at 11:11 AM, Robert Kern > > wrote: >> >>On 10/11/10 8:44 AM, Jason Swails wrote: >> >> >> >>On Mon, Oct 11, 2010 at 9:25 AM, A

Re: harmful str(bytes)

2010-10-11 Thread Hallvard B Furuseth
Terry Reedy writes: >On 10/8/2010 9:31 AM, Hallvard B Furuseth wrote: >> That's not the point - the point is that for 2.* code which _uses_ str >> vs unicode, the equivalent 3.* code uses str vs bytes. Yet not the >> same way - a 2.* 'str' will sometimes be 3.* bytes, sometime str. So >> upgraded

Re: Adding to an Array inside a Dict

2010-10-11 Thread Robert Kern
On 10/11/10 1:29 PM, MRAB wrote: On 11/10/2010 15:55, MacOSX @ Rocteur.cc wrote: Hi, Is there an easier way to do this, I am adding/creating to an array inside a dict but can find a cleaner way: So I first check if the key exists already, if it does then I know I use append, if it does not I c

Re: help!!!

2010-10-11 Thread Emile van Sebille
On 10/11/2010 12:11 PM Jason Swails said... But tabs ARE spaces (specifically 3 of them), in a row ;) Hoo boy Duckingly, Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: harmful str(bytes)

2010-10-11 Thread Hallvard B Furuseth
Antoine Pitrou writes: >Hallvard B Furuseth wrote: >>Antoine Pitrou writes: >>>Hallvard B Furuseth wrote: The offender is bytes.__str__: str(b'foo') == "b'foo'". It's often not clear from looking at a piece of code whether some data is treated as strings or bytes, particularly when

Re: Difficulty in easy_install

2010-10-11 Thread Diez B. Roggisch
sankalp srivastava writes: > I am having difficulty in easy_installing > I use a proxy server and strange errors , like it can't fetch the > package is showing up . > the package is pyspeech ...please help me :( > > I don't know if the proxy server is causing the problems , in linux i > would ha

Re: Adding to an Array inside a Dict

2010-10-11 Thread Arnaud Delobelle
MRAB writes: > On 11/10/2010 15:55, MacOSX @ Rocteur.cc wrote: >> Hi, >> >> Is there an easier way to do this, I am adding/creating to an array >> inside a dict but can find a cleaner way: >> >> So I first check if the key exists already, if it does then I know I use >> append, if it does not I c

Standardizing RPython - it's time.

2010-10-11 Thread John Nagle
It may be time to standardize "RPython". There are at least three implementations of "RPython" variants - PyPy, Shed Skin, and RPython for LLVM. The first two are up and running. There's a theory paper on the subject: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.142.1457&rep=rep

Python deadlocks when Popen in multithread.

2010-10-11 Thread INADA Naoki
On Ubuntu 10.10 amd64 and dual-core CPU, following code deadlocks. What's wrong on this code? #http://codepad.org/GkoXHbik #!/usr/bin/env python from subprocess import * from threading import * THREAD_COUNT=50 def worker(): p = Popen(["cat"], stdin=PIPE, stdout=PIPE, stderr=STDOUT) out

Re: harmful str(bytes)

2010-10-11 Thread Stefan Behnel
Hallvard B Furuseth, 11.10.2010 21:50: Antoine Pitrou writes: 2) some unicode objects didn't have a succesful str() Python 3 fixes both these issues. Fixing 1) means there's no automatic coercion when trying to mix bytes and unicode. Fine, so programs will have to do it themselves... Yes, t

Re: Standardizing RPython - it's time.

2010-10-11 Thread Jed Smith
On Mon, Oct 11, 2010 at 4:01 PM, John Nagle wrote: > file:///C:/Users/nagle/AppData/Local/Temp/shedskin-tutorial-0.3.html This gives me a 404. Your Web server is broken! Fix it! ;) Temporarily mirrored: http://jedsmith.org/tmp/shedskin-tutorial-0.5.html -- Jed Smith j...@jedsmith.org -- http

Re: Python deadlocks when Popen in multithread.

2010-10-11 Thread Jed Smith
On Mon, Oct 11, 2010 at 4:19 PM, INADA Naoki wrote: > def worker(): >    p = Popen(["cat"], stdin=PIPE, stdout=PIPE, stderr=STDOUT) >    out = p.communicate("hoge")[0] >    print "%s %s" % (current_thread().name, out) If, instead of spawning workers you directly call worker(), does it succeed?

Re: Standardizing RPython - it's time.

2010-10-11 Thread John Nagle
On 10/11/2010 1:01 PM, John Nagle wrote: (Correct Shed Skin tutorial link) > Shed Skin: > http://shedskin.googlecode.com/files/shedskin-tutorial-0.3.html -- http://mail.python.org/mailman/listinfo/python-list

urllib2 script slowing and stopping

2010-10-11 Thread Dantium
I have a small script that reads several CSV files in a directory and puts the data in a DB using Django. There are about 1.7 million records in 120 CSV files, I am running the script on a VPS with about 512mb of memory python 2.6.5 on ubuntu 10.04. The script gets slow and seems to lock after ab

Re: help!!!

2010-10-11 Thread Seebs
On 2010-10-11, Lawrence D'Oliveiro wrote: > In message , Seebs wrote: >> ... but I wasn't aware that it had been deprecated, except in the sense of >> being derided and dismissed as of no value. > What more did you want? :) Well, formal "deprecation" in the language standards sense, as in, "warn

Re: Standardizing RPython - it's time.

2010-10-11 Thread Ryan Kelly
On Mon, 2010-10-11 at 13:01 -0700, John Nagle wrote: > It may be time to standardize "RPython". > >There are at least three implementations of "RPython" variants - PyPy, > Shed Skin, and RPython for LLVM. The first two are up and running. > There's a theory paper on the subject: > > http://c

Re: urllib2 script slowing and stopping

2010-10-11 Thread Ian
On Oct 11, 2:48 pm, Dantium wrote: > I have a small script that reads several CSV files in a directory and > puts the data in a DB using Django. > > There are about 1.7 million records in 120 CSV files, I am running the > script on a VPS with about 512mb of memory python 2.6.5 on ubuntu > 10.04. >

Re: help!!!

2010-10-11 Thread geremy condra
On Mon, Oct 11, 2010 at 12:11 PM, Jason Swails wrote: > > > On Mon, Oct 11, 2010 at 3:05 PM, Robert Kern wrote: >> >> On 10/11/10 11:44 AM, Jason Swails wrote: >>> >>> >>> On Mon, Oct 11, 2010 at 11:11 AM, Robert Kern >> > wrote: >>> >>>    On 10/11/10 8:44 AM, Jason

Re: help!!!

2010-10-11 Thread Jed Smith
On Mon, Oct 11, 2010 at 5:02 PM, Seebs wrote: > and something like scanf(), where I've never heard of a compiler doing > anything of the sort. By default, MSVC complains hard enough when using scanf() to make you regret it (I think? been a while). -- Jed Smith j...@jedsmith.org -- http://mai

RE: Unicode Decode Error

2010-10-11 Thread Pratik Khemka
This is the original full traceback. when I was getting the Unicode Decode Error.. Traceback (most recent call last): File "C:\Documents and Settings\pkhemka\My Documents\merge_py.py", line 315, i n wbk.save('p4_merge.xls') File "C:\Python25\lib\site-packages\xlwt\Workbook.py", line

Re: harmful str(bytes)

2010-10-11 Thread Hallvard B Furuseth
Terry Reedy writes: >On 10/8/2010 9:45 AM, Hallvard B Furuseth wrote: >>> Actually, the implicit contract of __str__ is that it never fails, so >>> that everything can be printed out (for debugging purposes, etc.). >> >> Nope: >> >> $ python2 -c 'str(u"\u1000")' >> Traceback (most recent call last)

Re: harmful str(bytes)

2010-10-11 Thread Hallvard B Furuseth
Stefan Behnel writes: >Hallvard B Furuseth, 11.10.2010 21:50: >> Fine, so programs will have to do it themselves... > > Yes, they can finally handle bytes and Unicode data correctly and > safely. Having byte data turn into Unicode strings unexpectedly makes > the behaviour of your code hardly predi

Re: EOF while scanning triple-quoted string literal

2010-10-11 Thread Rhodri James
On Mon, 11 Oct 2010 10:37:09 +0100, bussiere bussiere wrote: i've looked on the web and here but i didn't find an answer : here is my code zlib.decompress(""" xワᆳヤ=ラᄇHナs~Ʀᄑç\ムîà z...@ÑÁÔqÇlxÇÆïpp~ývãì゙m6ÛÐ|ê֭ᄁᄂヤ=)}éÓUe﬿ö3ᄎᄌú"}ʿïÿ÷1þ8ñ́U÷ᄏñíLÒVi:`ᄈᄎL!Ê҆p6-%Fë^ヘ÷à,Q.K!ユô`ÄA!ÑêweÌ ÊÚAロYøøÂjôóᅠÂcñ

Re: Unicode Decode Error

2010-10-11 Thread Ian Kelly
On Mon, Oct 11, 2010 at 3:44 PM, Pratik Khemka wrote: > I tried to solve it using this *wbk = xlwt.Workbook('utf-8')... *The > problem still persists. Is there a way I can solve this problem..? > > *Traceback (most recent call last): > File "C:\Documents and Settings\pkhemka\My Documents\merge_

Re: harmful str(bytes)

2010-10-11 Thread Antoine Pitrou
On Mon, 11 Oct 2010 21:50:32 +0200 Hallvard B Furuseth wrote: > > I'd just posted an example in article : > > urllib.parse.urlunparse(('', '', '/foo', b'bar', '', '')) returns > "/foo;b'bar'" instead of raising an exception or returning 2.6's correct > "/foo;bar". Oh, this looks like a bug in u

Re: EOF while scanning triple-quoted string literal

2010-10-11 Thread Ian Kelly
On Mon, Oct 11, 2010 at 3:59 PM, Rhodri James wrote: > On Mon, 11 Oct 2010 10:37:09 +0100, bussiere bussiere > wrote: > > > i've looked on the web and here but i didn't find an answer : here is my >> code >> >> zlib.decompress(""" >> xワᆳヤ=ラᄇHナs~Ʀᄑç\ムîà >> z...@ÑÁÔqÇlxÇÆïpp >> ~ýVãì゙M6ÛÐ|ê֭ᄁᄂヤ=)}

Re: Class-level variables - a scoping issue

2010-10-11 Thread Ixokai
On 10/9/10 10:30 PM, John Nagle wrote: > Python protects global variables from similar confusion > by making them read-only when referenced from an inner scope > without a "global" statement. No. It doesn't. Assignments simply always apply to local variables, unless you explicitly indicate oth

Re: urllib2 script slowing and stopping

2010-10-11 Thread Dantium
On Oct 11, 10:07 pm, Ian wrote: > On Oct 11, 2:48 pm, Dantium wrote: > > > I have a small script that reads several CSV files in a directory and > > puts the data in a DB using Django. > > > There are about 1.7 million records in 120 CSV files, I am running the > > script on a VPS with about 512m

Re: Missing modules for python

2010-10-11 Thread Steven D'Aprano
On Mon, 11 Oct 2010 10:32:44 -0400, Jed Smith wrote: > simplejson got merged into the standard library in Python 2.6. In > libcloud, I wrote this: > > try: import json > except ImportError, excp: import simplejson as json I'm curious why you bother to bind the exception to the excp when you

Re: How is correct use of eval()

2010-10-11 Thread Steven D'Aprano
On Mon, 11 Oct 2010 11:18:37 -0700, Chris Rebert wrote: > On Mon, Oct 11, 2010 at 11:11 AM, Cata wrote: >> Hi . >> I read about eval(). >> I also read about this "bug" : >> cod = raw_input ('Enter:") >> eval (cod) >> if i use  "rm -rf ~"  all files will be deleted . > > That's incorrect. eval()

Re: help!!!

2010-10-11 Thread Steven D'Aprano
On Mon, 11 Oct 2010 10:11:37 -0500, Robert Kern wrote: > On 10/11/10 8:44 AM, Jason Swails wrote: >> >> >> On Mon, Oct 11, 2010 at 9:25 AM, Andreas Waldenburger >> wrote: >> >> On Mon, 11 Oct 2010 23:51:46 +1300 Lawrence D'Oliveiro >> wrote: >> >> > In message >

Re: help!!!

2010-10-11 Thread Robert Kern
On 10/11/10 6:17 PM, Steven D'Aprano wrote: On Mon, 11 Oct 2010 10:11:37 -0500, Robert Kern wrote: On 10/11/10 8:44 AM, Jason Swails wrote: On Mon, Oct 11, 2010 at 9:25 AM, Andreas Waldenburger wrote: On Mon, 11 Oct 2010 23:51:46 +1300 Lawrence D'Oliveiro wrote: > In m

Re: Class-level variables - a scoping issue

2010-10-11 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: In message <8hfq23fet...@mid.individual.net>, Gregory Ewing wrote: How would you intend to enforce such a restriction? The same way it’s already enforced. I don't see how that's possible, except in a very limited and unreliable way. The compiler would have to be a

Re: Help with sets

2010-10-11 Thread Gregory Ewing
Robert Kern wrote: The reasoning for this decision is spelled out in the PEP introducing the iterator feature: http://www.python.org/dev/peps/pep-0234/ There's also the question of whether 'if x in dict' should compare keys only or both keys and values. This was also hotly debated back whe

Re: I don't get why sys.exit(1) doesn't exit the while loop in the follow case

2010-10-11 Thread Nobody
On Mon, 11 Oct 2010 05:42:39 -0700, Ethan Furman wrote: >>>If I'm catching exceptions in order to perform clean-up, I'll use a bare >>>except and re-raise the exception afterwards. In that situation, a bare >>>except is usually the right thing to do. >> >> Wrong way to do it. > > What, then, is

Re: How is correct use of eval()

2010-10-11 Thread Nobody
On Mon, 11 Oct 2010 11:18:37 -0700, Chris Rebert wrote: >> What is correct way to use this function? > > To not use it in the first place if at all possible (use int(), > float(), getattr(), etc. instead, Use read(). Oh wait, Python doesn't have that. Because parsing literals and executing code

  1   2   >