Re: Python 3 and easygui problem

2009-02-21 Thread Gabriel Genellina
En Sun, 22 Feb 2009 03:05:51 -0200, Chris Rebert escribió: On Sat, Feb 21, 2009 at 8:46 PM, Peter Anderson wrote: I have just installed Python 3. I have been using Tkinter and easygui (with Python 2.5.4) for any GUI needs. I have just started to port some of my existing scripts to Python

Re: datetime.time and midnight

2009-02-21 Thread Gabriel Genellina
En Sat, 21 Feb 2009 21:55:23 -0200, MRAB escribió: Ethan Furman wrote: Greetings, List! I was curious if anyone knew the rationale behind making midnight False? --> import datetime --> midnight = datetime.time(0,0,0) --> bool(midnight) False To my way of thinking, midnight does actuall

Re: Python dictionary size/entry limit?

2009-02-21 Thread intelliminer
On Feb 21, 6:47 pm, Stefan Behnel wrote: > intellimi...@gmail.com wrote: > > I wrote a script to process textual data and extract phrases from > > them, storing these phrases in a dictionary. It encounters a > > MemoryError when there are about 11.18M keys in the dictionary, and > > the size is ab

Re: datetime.time and midnight

2009-02-21 Thread Steven D'Aprano
Paddy3118 wrote: > Ethan, > Knights are true and seek the light. Evil trolls seek the night and so > their hour is false. > > ;-) That's speciest *and* lightist. There's nothing wrong with avoiding the evil burning day star, that's practically de rigour for programmers. *wink* -- Steven

Re: Find the location of a loaded module

2009-02-21 Thread Gabriel Genellina
En Sat, 21 Feb 2009 14:51:40 -0200, escribió: "Gabriel Genellina" wrote: En Fri, 20 Feb 2009 20:44:21 -0200, Aaron Scott escribi=F3: > So, the problem lies with how Python cached the modules in memory. > Yes, the modules were in two different locations and yes, the one that > I specified us

Problem trying to install ReportLab with easy_install

2009-02-21 Thread Sebastian Bassi
I don't understand what is wrong when I try to install ReportLab. This is under Ubuntu and all build packages are installed. Here is what I get when trying to install it: (I could install it with apt-get, but I am testing virtualenv and easy_install). (testbio149)vi...@maricurie:~/Public/testbio14

Re: datetime.time and midnight

2009-02-21 Thread Paddy3118
On Feb 21, 10:44 pm, Ethan Furman wrote: > Greetings, List! > > I was curious if anyone knew the rationale behind making midnight False? > > --> import datetime > --> midnight = datetime.time(0,0,0) > --> bool(midnight) > False > > To my way of thinking, midnight does actually exist so it should b

Re: multiprocessing module and os.close(sys.stdin.fileno())

2009-02-21 Thread Graham Dumpleton
On Feb 22, 12:52 pm, Joshua Judson Rosen wrote: > Graham Dumpleton writes: > > > On Feb 21, 4:20 pm, Joshua Judson Rosen wrote: > > > Jesse Noller writes: > > > > > On Tue, Feb 17, 2009 at 10:34 PM, Graham Dumpleton > > > > wrote: > > > > > Why is the multiprocessing module, ie., multiprocessi

Re: To unicode or not to unicode

2009-02-21 Thread Joshua Judson Rosen
Ross Ridge writes: > > > It's all about declaring your charset. In Python as well as in your > > newsreader. If you don't declare your charset it's ASCII for you - in > > Python as well as in your newsreader. > > Except in practice unlike Python, many newsreaders don't assume ASCII. > The origi

Re: Python 3 and easygui problem

2009-02-21 Thread Chris Rebert
On Sat, Feb 21, 2009 at 8:46 PM, Peter Anderson wrote: > I have just installed Python 3. I have been using Tkinter and easygui (with > Python 2.5.4) for any GUI needs. I have just started to port some of my > existing scripts to Python 3 and discovered problems with easygui. > > I was using the fo

Python 3 and easygui problem

2009-02-21 Thread Peter Anderson
I have just installed Python 3. I have been using Tkinter and easygui (with Python 2.5.4) for any GUI needs. I have just started to port some of my existing scripts to Python 3 and discovered problems with easygui. I was using the following script for testing: from easygui import * import sys

Re: To unicode or not to unicode

2009-02-21 Thread Martin v. Löwis
> Since when is "Google Groups" a newsreader? So far as I know, all > the display/formatting is handled by my web browser and GG merely stuffs > messages into an HTML wrapper... It also transmits this HTML wrapper via HTTP, where it claims that the charset of the HTML is UTF-8. To do that, i

Re: To unicode or not to unicode

2009-02-21 Thread Steve Holden
Thorsten Kampe wrote: > * Ross Ridge (Sat, 21 Feb 2009 14:52:09 -0500) >> Thorsten Kampe wrote: >>> It's all about declaring your charset. In Python as well as in your >>> newsreader. If you don't declare your charset it's ASCII for you - in >>> Python as well as in your newsreader. >> Except in

Re: Wanted: Online Python Course for Credit

2009-02-21 Thread Steve Holden
Scott David Daniels wrote: > jsidell wrote: >> I'm a high school game development teacher and I have recently >> discovered Python to be a great way to introduce computer >> programming. I intend to study Python on my own but I can get >> professional development credit at my job for taking a Pyth

Re: count secton of data in list

2009-02-21 Thread odeits
On Feb 20, 3:45 pm, Emile van Sebille wrote: > brianrpsgt1 wrote: > > > def step1(val): > >        data2_row = [] > > >     for d1r in data1_row: > >         if d1r[1] >= val: > >             switch = 0 > >             data2_row = d1r[0],d1r[1],d1r[2],switch > >                data2_row.append([d1

Re: Python dictionary size/entry limit?

2009-02-21 Thread Sean
Stefan Behnel wrote: intellimi...@gmail.com wrote: You may be better served with one of the dbm databases that come with Python. They live on-disk but do the usual in-memory caching. They'll likely perform a lot better than your OS level swap file. Stefan the bsddb module has the feature that

Re: multiprocessing module and os.close(sys.stdin.fileno())

2009-02-21 Thread Joshua Judson Rosen
Graham Dumpleton writes: > > On Feb 21, 4:20 pm, Joshua Judson Rosen wrote: > > Jesse Noller writes: > > > > > On Tue, Feb 17, 2009 at 10:34 PM, Graham Dumpleton > > > wrote: > > > > Why is the multiprocessing module, ie., multiprocessing/process.py, in > > > > _bootstrap() doing: > > > > > >  

Re: Using clock() in threading on Windows

2009-02-21 Thread David Bolen
"Martin v. Löwis" writes: > As a consequence, the half-busy loops could go away, at least > on systems where lock timeouts can be given to the system. I know that in some cases in the past I've had to bypass a Queue's use of threading objects for waiting for a queue to unblock because of the inc

Re: To unicode or not to unicode

2009-02-21 Thread Thorsten Kampe
* Ross Ridge (Sat, 21 Feb 2009 19:39:42 -0500) > Thorsten Kampe wrote: > >That's right. As long as you use pure ASCII you can skip this nasty step > >of informing other people which charset you are using. If you do use non > >ASCII then you have to do that. That's the way virtually all newsread

Re: Pythonic way to determine if one char of many in a string

2009-02-21 Thread odeits
On Feb 21, 2:24 pm, rdmur...@bitdance.com wrote: > odeits wrote: > > On Feb 21, 12:47=A0am, "Gabriel Genellina" > > wrote: > > > En Sat, 21 Feb 2009 01:14:02 -0200, odeits escribi=F3: > > > > > On Feb 15, 11:31=A0pm, odeits wrote: > > > >> It seems what you are actually testing for is if the in

Re: To unicode or not to unicode

2009-02-21 Thread Ross Ridge
Ross Ridge (Sat, 21 Feb 2009 18:06:35 -0500) > I understand what Unicode and MIME are for and why they exist. Neither > their merits nor your insults change the fact that the only current > standard governing the content of Usenet posts doesn't require their > use. Thorsten Kampe wrote: >That's

Re: multiprocessing module and os.close(sys.stdin.fileno())

2009-02-21 Thread Graham Dumpleton
On Feb 21, 4:20 pm, Joshua Judson Rosen wrote: > Jesse Noller writes: > > > On Tue, Feb 17, 2009 at 10:34 PM, Graham Dumpleton > > wrote: > > > Why is the multiprocessing module, ie., multiprocessing/process.py, in > > > _bootstrap() doing: > > > >  os.close(sys.stdin.fileno()) > > > > rather th

Re: datetime.time and midnight

2009-02-21 Thread MRAB
Ethan Furman wrote: Greetings, List! I was curious if anyone knew the rationale behind making midnight False? --> import datetime --> midnight = datetime.time(0,0,0) --> bool(midnight) False To my way of thinking, midnight does actually exist so it should be true. If datetime.time was measur

Re: To unicode or not to unicode

2009-02-21 Thread Thorsten Kampe
* Ross Ridge (Sat, 21 Feb 2009 18:06:35 -0500) > > The link demonstrates that Google Groups doesn't assume ASCII like > > Python does. Since popular newsreaders like Google Groups and Outlook > > Express can display the message correctly without the MIME headers, > > but your obscure one can't, th

Re: zlib interface semi-broken

2009-02-21 Thread Aahz
In article , Travis wrote: > >So I've submitted a patch to bugs.python.org to add a new member >called is_finished to the zlib decompression object. > >Issue 5210, file 13056, msg 81780 You may also want to bring this up on the python-ideas mailing list for further discussion. -- Aahz (a...@pyt

Re: To unicode or not to unicode

2009-02-21 Thread Ross Ridge
Ross Ridge (Sat, 21 Feb 2009 17:07:35 -0500) > The link demonstrates that Google Groups doesn't assume ASCII like > Python does. Since popular newsreaders like Google Groups and Outlook > Express can display the message correctly without the MIME headers, > but your obscure one can't, there's a m

Re: To unicode or not to unicode

2009-02-21 Thread Thorsten Kampe
* Ross Ridge (Sat, 21 Feb 2009 17:07:35 -0500) > The link demonstrates that Google Groups doesn't assume ASCII like > Python does. Since popular newsreaders like Google Groups and Outlook > Express can display the message correctly without the MIME headers, > but your obscure one can't, there's a

datetime.time and midnight

2009-02-21 Thread Ethan Furman
Greetings, List! I was curious if anyone knew the rationale behind making midnight False? --> import datetime --> midnight = datetime.time(0,0,0) --> bool(midnight) False To my way of thinking, midnight does actually exist so it should be true. If datetime.time was measuring an *amount* of ti

Re: Pythonic way to determine if one char of many in a string

2009-02-21 Thread rdmurray
odeits wrote: > On Feb 21, 12:47=A0am, "Gabriel Genellina" > wrote: > > En Sat, 21 Feb 2009 01:14:02 -0200, odeits escribi=F3: > > > > > On Feb 15, 11:31=A0pm, odeits wrote: > > >> It seems what you are actually testing for is if the intersection of > > >> the two sets is not empty where the fi

Re: To unicode or not to unicode

2009-02-21 Thread Carl Banks
On Feb 19, 6:57 pm, Ron Garret wrote: > I'm writing a little wiki that I call µWiki.  That's a lowercase Greek > mu at the beginning (it's pronounced micro-wiki).  It's working, except > that I can't actually enter the name of the wiki into the wiki itself > because the default unicode encoding on

Re: To unicode or not to unicode

2009-02-21 Thread Ross Ridge
Ross Ridge (Sat, 21 Feb 2009 14:52:09 -0500) > Except in practice unlike Python, many newsreaders don't assume ASCII. Thorsten Kampe wrote: >They assume ASCII - unless you declare your charset (the exception being >Outlook Express and a few Windows newsreaders). Everything else is >"guessing".

Re: `high overhead of multiple Python processes' (was: Will multithreading make python less popular?)

2009-02-21 Thread Paul Rubin
Joshua Judson Rosen writes: > > Right, that's basically the issue here: the cost of using multiple > > Python processes is unnecessarily high. > What cost is that? The cost of messing with the multiprocessing module instead of having threads work properly, and the overhead of serializing Python

Re: python contextmanagers and ruby blocks

2009-02-21 Thread Alia K
Aahz wrote: > Longer answer: the way in Python to achieve the full power of Ruby > blocks is to write a function. You are most likely right... there is probably no need to introduce ruby-like blocks to python where iteration comes naturally with list comprehensions and generators. But for the simp

Re: Pythonic way to determine if one char of many in a string

2009-02-21 Thread odeits
On Feb 21, 12:47 am, "Gabriel Genellina" wrote: > En Sat, 21 Feb 2009 01:14:02 -0200, odeits escribió: > > > > > On Feb 15, 11:31 pm, odeits wrote: > >> It seems what you are actually testing for is if the intersection of > >> the two sets is not empty where the first set is the characters in >

Re: To unicode or not to unicode

2009-02-21 Thread Thorsten Kampe
* Ross Ridge (Sat, 21 Feb 2009 14:52:09 -0500) > Thorsten Kampe wrote: >> It's all about declaring your charset. In Python as well as in your >> newsreader. If you don't declare your charset it's ASCII for you - in >> Python as well as in your newsreader. > > Except in practice unlike Python, ma

Re: What encoding does u'...' syntax use?

2009-02-21 Thread Denis Kasak
On Sat, Feb 21, 2009 at 9:45 PM, "Martin v. Löwis" wrote: >>> Indeed. As Python *can* encode all characters even in 2-byte mode >>> (since PEP 261), it seems clear that Python's Unicode representation >>> is *not* strictly UCS-2 anymore. >> >> Since we're already discussing this, I'm curious - why

Re: What encoding does u'...' syntax use?

2009-02-21 Thread Martin v. Löwis
>> Indeed. As Python *can* encode all characters even in 2-byte mode >> (since PEP 261), it seems clear that Python's Unicode representation >> is *not* strictly UCS-2 anymore. > > Since we're already discussing this, I'm curious - why was UCS-2 > chosen over plain UTF-16 or UTF-8 in the first pla

Re: What encoding does u'...' syntax use?

2009-02-21 Thread Adam Olsen
On Feb 21, 10:48 am, a...@pythoncraft.com (Aahz) wrote: > In article <499f397c.7030...@v.loewis.de>, > > =?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?=   wrote: > >> Yes, I know that.  But every concrete representation of a unicode string > >> has to have an encoding associated with it, including unic

Re: urllib2 login help

2009-02-21 Thread Stephen Hansen
> > *ANY* hints/suggestions/directions would be very appreciated since > I've run out of ideas of things to try at this point. > The last time I heard something like this, I suggested that the problem might be cookies -- and it ended up working for the person I believe. http://groups.google.com/g

urllib2 login help

2009-02-21 Thread john . weatherwax
Hello, I'm having trouble using urllib2 (maybe) when trying to log into a web site that requires a user to enter a login name and a password (authentication). I've tried many things but none seem to work and have become stuck recently and was hoping to get a hint from those much more knowledgeabl

Re: What encoding does u'...' syntax use?

2009-02-21 Thread Denis Kasak
On Sat, Feb 21, 2009 at 9:10 PM, "Martin v. Löwis" wrote: >>> I'm pretty much sure it is UCS-2 or UCS-4. (Yes, I know there is only a >>> slight difference to UTF-16/UTF-32). >> >> I wouldn't call the difference that slight, especially between UTF-16 >> and UCS-2, since the former can encode all U

Re: `high overhead of multiple Python processes' (was: Will multithreading make python less popular?)

2009-02-21 Thread Joshua Judson Rosen
Paul Rubin writes: > > Right, that's basically the issue here: the cost of using multiple > Python processes is unnecessarily high. If that cost were lower then > we could more easily use multiple cores to make oru apps faster. What cost is that? At least on unix sy

Re: What encoding does u'...' syntax use?

2009-02-21 Thread Martin v. Löwis
>> I'm pretty much sure it is UCS-2 or UCS-4. (Yes, I know there is only a >> slight difference to UTF-16/UTF-32). > > I wouldn't call the difference that slight, especially between UTF-16 > and UCS-2, since the former can encode all Unicode code points, while > the latter can only encode those in

Re: What encoding does u'...' syntax use?

2009-02-21 Thread Martin v. Löwis
>>> My question is: what is that encoding? >> The internal representation is either UTF-16, or UTF-32; which one is >> a compile-time choice (i.e. when the Python interpreter is built). > > Wait, I thought it was UCS-2 or UCS-4? Or am I misremembering the > countless threads about the distinction

Re: To unicode or not to unicode

2009-02-21 Thread Ross Ridge
Thorsten Kampe wrote: >> RFC 1036 doesn't require nor give a meaning to a Content-Type header >> in a Usenet message > >Well, /maybe/ the reason for that is that RFC 1036 was written in 1987 >and the first MIME RFC in 1992...? Obviously. >"Son of RFC 1036" mentions MIME more often than you can

Re: What encoding does u'...' syntax use?

2009-02-21 Thread Denis Kasak
On Sat, Feb 21, 2009 at 7:24 PM, Thorsten Kampe wrote: > > I'm pretty much sure it is UCS-2 or UCS-4. (Yes, I know there is only a > slight difference to UTF-16/UTF-32). I wouldn't call the difference that slight, especially between UTF-16 and UCS-2, since the former can encode all Unicode code p

Re: Change in cgi handling of POST requests

2009-02-21 Thread Bob Kline
Aahz wrote: Interesting. Nobody has responded, so I suggest first filing a report using bugs.python.org and then asking on python-dev (with reference to your report). http://bugs.python.org/issue5340 Cheers, Bob -- http://mail.python.org/mailman/listinfo/python-list

Re: "Byte" type?

2009-02-21 Thread Benjamin Kaplan
On Sat, Feb 21, 2009 at 12:21 PM, John Nagle wrote: > Steve Holden wrote: > >> John Nagle wrote: >> >>> Steve Holden wrote: >>> John Nagle wrote: > Benjamin Kaplan wrote: > >> On Sun, Feb 15, 2009 at 11:57 AM, John Nagle >> wrote: >> >> ...Re "bytes" not behavi

Ctypes debug of dll function

2009-02-21 Thread Massi
Hi everyone, I'm pretty new to the ctypes module and I'm encountering a problem. I'm working under windows xp with python 2.5 and in my script I use ctypes to call from a dll some functions I wrote in C. When I call one of these functions it happens that my script crashes raising the following erro

Re: What encoding does u'...' syntax use?

2009-02-21 Thread Thorsten Kampe
* "Martin v. Löwis" (Sat, 21 Feb 2009 00:15:08 +0100) > > Yes, I know that. But every concrete representation of a unicode > > string has to have an encoding associated with it, including unicode > > strings produced by the Python parser when it parses the ascii > > string "u'\xb5'" > > > > My que

Re: To unicode or not to unicode

2009-02-21 Thread Thorsten Kampe
* Ross Ridge (Sat, 21 Feb 2009 12:22:36 -0500) > =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= wrote: > >I don't think that was the complaint. Instead, the complaint was > >that the OP's original message did not have a Content-type header, > >and that it was thus impossible to tell what the byte in front

Re: What encoding does u'...' syntax use?

2009-02-21 Thread Aahz
In article <499f397c.7030...@v.loewis.de>, =?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?= wrote: >> Yes, I know that. But every concrete representation of a unicode string >> has to have an encoding associated with it, including unicode strings >> produced by the Python parser when it parses the

Re: can multi-core improve single funciton?

2009-02-21 Thread Aahz
In article , Grant Edwards wrote: >On 2009-02-20, Aahz wrote: >> Steven D'Aprano wrote: >>> >>> As I understand it, there's very little benefit to multi-cores in >>> Python due to the GIL. >> >> As phrased, your statement is completely wrong. Here's a more >> correct phrasing: "For threaded c

Re: python contextmanagers and ruby blocks

2009-02-21 Thread Aahz
In article , Alia K wrote: > >Nevertheless, I remain curious about whether once can use the >contextmanager in python to achieve the full power of ruby's blocks... Short answer: no Longer answer: the way in Python to achieve the full power of Ruby blocks is to write a function. -- Aahz (a...@p

Re: "Byte" type?

2009-02-21 Thread Christian Heimes
John Nagle wrote >If "bytes", a new keyword, works differently in 2.6 and 3.0, that was > really > dumb. There's no old code using "bytes". So converting code to 2.6 means > it has to be converted AGAIN for 3.0. That's a good reason to ignore > 2.6 as > defective. Please don't call somethin

Re: To unicode or not to unicode

2009-02-21 Thread Ross Ridge
=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= wrote: >I don't think that was the complaint. Instead, the complaint was >that the OP's original message did not have a Content-type header, >and that it was thus impossible to tell what the byte in front of >"Wiki" meant. To properly post either MICRO SIGN or

Re: Wanted: Online Python Course for Credit

2009-02-21 Thread Scott David Daniels
jsidell wrote: I'm a high school game development teacher and I have recently discovered Python to be a great way to introduce computer programming. I intend to study Python on my own but I can get professional development credit at my job for taking a Python course. So I'm looking for an online

Re: Find the location of a loaded module

2009-02-21 Thread rdmurray
"Gabriel Genellina" wrote: > En Fri, 20 Feb 2009 20:44:21 -0200, Aaron Scott > escribi=F3: > > > So, the problem lies with how Python cached the modules in memory. > > Yes, the modules were in two different locations and yes, the one that > > I specified using its direct path should be the one l

Re: "Byte" type?

2009-02-21 Thread John Nagle
Steve Holden wrote: John Nagle wrote: Steve Holden wrote: John Nagle wrote: Benjamin Kaplan wrote: On Sun, Feb 15, 2009 at 11:57 AM, John Nagle wrote: ...Re "bytes" not behaving as documented in 2.6: That's indeed how Python 2.6 works. But that's not how PEP 3137 says it's supposed t

Re: how to assert that method accepts specific types

2009-02-21 Thread Scott David Daniels
Rhodri James wrote: On Sat, 21 Feb 2009 01:12:01 -, Darren Dale wrote: I would like to assert that a method accepts certain types from functools import wraps def accepts(*types): def check_accepts(f): ... class Test(object): @accepts(int) def check(se

Re: ordinal not in range

2009-02-21 Thread Jaap van Wingerde
Stefan Behnel wrote: Omschrijving = Omschrijving.replace(u"priv?", u'privé') (mind the u"...") outfile = codecs.open(output, "wb", encoding="UTF-8") (mind the "wb" for 'write binary/bytes') It works now! Looks like you'd be happier with Python 3.0, BTW... Python 3 is not in De

Re: TypeError: descriptor 'replace' requires a 'str' object but received a 'unicode'

2009-02-21 Thread Steve Holden
Jaap van Wingerde wrote: > # -*- coding: utf_8 -*- > Omschrijving = u'priv? assuranti?n' # string from a bank.csv > Omschrijving = str.replace(Omschrijving, "priv?", 'privé') > Omschrijving = str.replace(Omschrijving, "Assuranti?n", 'Assurantiën') > print Omschrijving > > When I run this script I

Python C-API Object Allocation

2009-02-21 Thread William Newbery
Ive been learning the C-API lately so I can write python extensions for some of my c++ stuff. I want to use the new and delete operators for creating and destroying my objects. The problem is python seems to break it into several stages. tp_new, tp_init and tp_alloc for creation and tp_del, t

Re: Change in cgi handling of POST requests

2009-02-21 Thread Aahz
[posted & e-mailed] In article , Mac wrote: > >We just upgraded Python to 2.6 on some of our servers and a number of >our CGI scripts broke because the cgi module has changed the way it >handles POST requests. When the 'action' attribute was not present in >the form element on an HTML page the

Re: ordinal not in range

2009-02-21 Thread Stefan Behnel
Jaap van Wingerde wrote: > Stefan Behnel wrote: >> Omschrijving = Omschrijving.replace("priv?", 'privé') actually, make that Omschrijving = Omschrijving.replace(u"priv?", u'privé') (mind the u"...") > > import codecs > file = "postbank.csv" > output = "%s.eb" % file > outfile

Re: "Byte" type?

2009-02-21 Thread Steve Holden
John Nagle wrote: > Steve Holden wrote: >> John Nagle wrote: >>> Benjamin Kaplan wrote: On Sun, Feb 15, 2009 at 11:57 AM, John Nagle wrote: > ...Re "bytes" not behaving as documented in 2.6: > >>>That's indeed how Python 2.6 works. But that's not how >>> PEP 3137 says it's supposed

Re: Uploading big files wit cherrypy

2009-02-21 Thread Aahz
In article <366595b2-226c-48e4-961d-85bd0ce4b...@h16g2000yqj.googlegroups.com>, Farsheed Ashouri wrote: > >But I couldn't upload files bigger than 100Mb. Why and what is >workaround? What happens when you upload a file larger than 100MB? -- Aahz (a...@pythoncraft.com) <*> htt

ordinal not in range

2009-02-21 Thread Jaap van Wingerde
Stefan Behnel wrote: Omschrijving = Omschrijving.replace("priv?", 'privé') I Thank you, this works now, but I get a new error message. import codecs file = "postbank.csv" output = "%s.eb" % file outfile = codecs.open(output, "w", "utf_8") Omschrijving = u'priv? assuranti?n' # stri

Re: TypeError: descriptor 'replace' requires a 'str' object but received a 'unicode'

2009-02-21 Thread Stefan Behnel
Jaap van Wingerde wrote: > # -*- coding: utf_8 -*- > Omschrijving = u'priv? assuranti?n' # string from a bank.csv > Omschrijving = str.replace(Omschrijving, "priv?", 'privé') > Omschrijving = str.replace(Omschrijving, "Assuranti?n", 'Assurantiën') > print Omschrijving > > When I run this script I

TypeError: descriptor 'replace' requires a 'str' object but received a 'unicode'

2009-02-21 Thread Jaap van Wingerde
# -*- coding: utf_8 -*- Omschrijving = u'priv? assuranti?n' # string from a bank.csv Omschrijving = str.replace(Omschrijving, "priv?", 'privé') Omschrijving = str.replace(Omschrijving, "Assuranti?n", 'Assurantiën') print Omschrijving When I run this script I get the following message. "Traceback

Re: python contextmanagers and ruby blocks

2009-02-21 Thread Alia K
Francesco wrote: > ... ruby code that shows the most twisted 'Hellow world' example I have > ever seen :-) ... and I was gunning for the simplest possible example (-: > ... python code doing the same thing - apparently - > of prevous ruby code, using context managers in a way that I believe the

Re: python contextmanagers and ruby blocks

2009-02-21 Thread Francesco Bochicchio
On Sat, 21 Feb 2009 00:46:08 -0800, Alia Khouri wrote: > As an exercise, I recently translated one of my python scripts (http:// > code.activestate.com/recipes/576643/) to haskell (a penultimate > version exists at > http://groups.google.com/group/comp.lang.haskell/browse_thread/thread/fb1ebd986b

Re: Python dictionary size/entry limit?

2009-02-21 Thread Stefan Behnel
intellimi...@gmail.com wrote: > I wrote a script to process textual data and extract phrases from > them, storing these phrases in a dictionary. It encounters a > MemoryError when there are about 11.18M keys in the dictionary, and > the size is about 1.5GB. > [...] > I have 1GB of pysical memory an

Re: Python dictionary size/entry limit?

2009-02-21 Thread intelliminer
On Feb 21, 6:25 pm, Tino Wildenhain wrote: > intellimi...@gmail.com wrote: > > I wrote a script to process textual data and extract phrases from > > them, storing these phrases in a dictionary. It encounters a > > MemoryError when there are about 11.18M keys in the dictionary, and > > the size is

Re: Python dictionary size/entry limit?

2009-02-21 Thread Tino Wildenhain
intellimi...@gmail.com wrote: I wrote a script to process textual data and extract phrases from them, storing these phrases in a dictionary. It encounters a MemoryError when there are about 11.18M keys in the dictionary, and the size is about 1.5GB. I tried multiple times, and the error occurs ev

Python dictionary size/entry limit?

2009-02-21 Thread intelliminer
I wrote a script to process textual data and extract phrases from them, storing these phrases in a dictionary. It encounters a MemoryError when there are about 11.18M keys in the dictionary, and the size is about 1.5GB. I tried multiple times, and the error occurs everytime at exactly the same plac

Re: Using clock() in threading on Windows

2009-02-21 Thread Martin v. Löwis
> Would it not be better to use time.clock() instead? If you really want to reconsider this implementation, I think it would be best to use relative timeouts all the way down to the system. In the specific case of Windows, WaitForSingleObject expects a relative number of milliseconds (i.e. a wait

Re: function factory question: embed current values of object attributes

2009-02-21 Thread Alan Isaac
Gabriel Genellina wrote: If you want a "frozen" function (that is, a function already set-up with the parameters taken from the current values of x.a, x.b) use functools.partial: OK, that's also a nice idea. Thanks! Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: function factory question: embed current values of object attributes

2009-02-21 Thread Alan Isaac
Terry Reedy wrote: You are now describing a function closure. Here is an example that might help. It does. Thanks, Alan -- http://mail.python.org/mailman/listinfo/python-list

python contextmanagers and ruby blocks

2009-02-21 Thread Alia Khouri
As an exercise, I recently translated one of my python scripts (http:// code.activestate.com/recipes/576643/) to haskell (a penultimate version exists at http://groups.google.com/group/comp.lang.haskell/browse_thread/thread/fb1ebd986b44244e# in case anyone is interested) with the result that haske

Re: Pythonic way to determine if one char of many in a string

2009-02-21 Thread Gabriel Genellina
En Sat, 21 Feb 2009 01:14:02 -0200, odeits escribió: On Feb 15, 11:31 pm, odeits wrote: It seems what you are actually testing for is if the intersection of the two sets is not empty where the first set is the characters in your word and the second set is the characters in your defined strin

Re: "import" not working?

2009-02-21 Thread Gabriel Genellina
En Fri, 20 Feb 2009 22:40:03 -0200, Lionel escribió: Okay, moving the wx example into the same directory containing the first example that was working fixed it. This directory only contains these two modules and nothing else. The old directory which contained the example that wasn't working d