Re: simple import hook

2011-11-14 Thread DevPlayer
An alternative approach: http://pastebin.com/z6pNqFYE or: # devpla...@gmail.com # 2011-Nov-15 # recordimports.py # my Import Hook Hack in response to: # http://groups.google.com/group/comp.lang.python/browse_thread/thread/5a5d5c724f142eb5?hl=en # as an initial learning exercise # This code ne

Re: (n00b) Tkinter trouble

2011-11-14 Thread Chris Angelico
On Tue, Nov 15, 2011 at 4:18 PM, Jason Swails wrote: > Of course!  Windows are widgets just like everything else is, and so can be > configured to be in the DISABLED state just like a button can.  I'm not used > to this hierarchy in which the root window presides over all, yet is still a > widget

Re: (n00b) Tkinter trouble

2011-11-14 Thread Jason Swails
On Mon, Nov 14, 2011 at 3:49 AM, Chris Angelico wrote: > On Mon, Nov 14, 2011 at 6:11 PM, Jason Swails > wrote: > > Then, I can reactivate all of the buttons in the destroy() method before > > calling the destroy() method of Toplevel on self. > > Small side point that might save you some work: I

Re: else in try/except

2011-11-14 Thread Barry W Brown
I thought that the point of the else clause is that it is reached only if there is no exception in the try clause. -- http://mail.python.org/mailman/listinfo/python-list

Re: Multilevel dicts/arrays v. tuples as keys?

2011-11-14 Thread alex23
Peter Otten <__pete...@web.de> wrote: > If you need lookup only I'd prefer tuples, but sometimes you may want to > retrieve all values with a certain k1 and > > d[k1] > > is certainly more efficient than > > [(k2, v) for (k1, k2), v in d.items() if k1 == wanted] This was the hidden cost of the tup

Re: Decorator question: prefer class, but only function works

2011-11-14 Thread Steven D'Aprano
On Mon, 14 Nov 2011 17:00:38 -0800, Russell E. Owen wrote: > Oops, I stripped so much out of my example that I stripped the ugly bit. > This is closer to the original and demonstrated the issue: > > def timeMethod(func): > name = func.__name__ + "Duration" > def wrapper(self, *args, **key

Re: Opportunity missed by Python ?

2011-11-14 Thread Steven D'Aprano
On Mon, 14 Nov 2011 15:59:39 -0800, DevPlayer wrote: > What I don't get is, having seen Python's syntax with indentation > instead of open and closing puncuation and other -readability- > structures in Python's syntax, is if someone is going to invent any new > language, how could they NOT take Py

Re: Opportunity missed by Python ?

2011-11-14 Thread Dominic Binks
I believe Occam had a visual structure and was compiled. In fact it was even more picky than Python in this respect IIRC. On 11/14/2011 4:28 PM, Chris Angelico wrote: On Tue, Nov 15, 2011 at 10:59 AM, DevPlayer wrote: What I don't get is, having seen Python's syntax with indentation instead

Re: Decorator question: prefer class, but only function works

2011-11-14 Thread Russell E. Owen
In article , Ian Kelly wrote: > On Thu, Nov 10, 2011 at 2:52 PM, Russell E. Owen wrote: > > I am trying to write a decorator that times an instance method and > > writes the results to a class member variable. For example: > > > > def timeMethod(func): > >    def wrapper(self, *args, **keyArgs

Re: else in try/except

2011-11-14 Thread Ethan Furman
Thanks, all! ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: Opportunity missed by Python ?

2011-11-14 Thread Chris Angelico
On Tue, Nov 15, 2011 at 10:59 AM, DevPlayer wrote: > What I don't get is, having seen Python's syntax with indentation > instead of open and closing puncuation and other -readability- > structures in Python's syntax, is if someone is going to invent any > new language, how could they NOT take Pyth

Re: Opportunity missed by Python ?

2011-11-14 Thread DevPlayer
What I don't get is, having seen Python's syntax with indentation instead of open and closing puncuation and other -readability- structures in Python's syntax, is if someone is going to invent any new language, how could they NOT take Python's visual structures (read as readability) and copy it, wh

Re: else in try/except

2011-11-14 Thread Chris Kaynor
On Mon, Nov 14, 2011 at 2:59 PM, MRAB wrote: > On 14/11/2011 21:53, Ethan Furman wrote: >> >> The code in 'else' in a 'try/except/else[/finally]' block seems >> pointless to me, as I am not seeing any difference between having the >> code in the 'else' suite vs having the code in the 'try' suite.

Re: else in try/except

2011-11-14 Thread Arnaud Delobelle
On 14 November 2011 21:53, Ethan Furman wrote: > The code in 'else' in a 'try/except/else[/finally]' block seems pointless to > me, as I am not seeing any difference between having the code in the 'else' > suite vs having the code in the 'try' suite. > > Can anybody shed some light on this for me?

Re: else in try/except

2011-11-14 Thread MRAB
On 14/11/2011 21:53, Ethan Furman wrote: The code in 'else' in a 'try/except/else[/finally]' block seems pointless to me, as I am not seeing any difference between having the code in the 'else' suite vs having the code in the 'try' suite. Can anybody shed some light on this for me? The differe

else in try/except

2011-11-14 Thread Ethan Furman
The code in 'else' in a 'try/except/else[/finally]' block seems pointless to me, as I am not seeing any difference between having the code in the 'else' suite vs having the code in the 'try' suite. Can anybody shed some light on this for me? ~Ethan~ -- http://mail.python.org/mailman/listinfo/p

Python Developer needed for Catalina Marketing - St. Petersburg

2011-11-14 Thread Chris Martel
We, at Catalina Marketing, are in need of a Python Developer for 3 - 6 months. You'd be writing highly sophisticated scripting in OO classes (cron) for our coupon campaigns. Also using SQLite, Oracle, and Netezza. Prefer someone who has at least 3-5 years of Python and database experience. The

Re: can't decompress data; zlib not available

2011-11-14 Thread Tim Wintle
On Mon, 2011-11-14 at 12:30 -0700, Steve Edlefsen wrote: > I did a search on files named "python" on my machine. > There are 23 not including the ones in the Plone > buildout-cache in my account. Seems like a lot of > applications install their own copy of python. > > There are also > > ./usr/li

Re: can't decompress data; zlib not available

2011-11-14 Thread Christian Heimes
Am 14.11.2011 20:30, schrieb Steve Edlefsen: > Sorry about that. Ubuntu 11.10. > > I used > > Plone-4.1.2-UnifiedInstaller.tar > > which installed o.k. I'm serving a webpage on my LAN. > > I did a search on files named "python" on my machine. > There are 23 not including the ones in the Plone

Re: Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Christian Heimes
Am 14.11.2011 19:28, schrieb Tobias Oberstein: > Thanks! This is probably the most practical option I can go. > > I've just tested: the backported new IO on Python 2.7 will indeed > open >32k files on FreeBSD. It also creates the files much faster. > The old, non-monkey-patched version was getting

Re: can't decompress data; zlib not available

2011-11-14 Thread Steve Edlefsen
Sorry about that. Ubuntu 11.10. I used Plone-4.1.2-UnifiedInstaller.tar which installed o.k. I'm serving a webpage on my LAN. I did a search on files named "python" on my machine. There are 23 not including the ones in the Plone buildout-cache in my account. Seems like a lot of applications

AW: Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Tobias Oberstein
> > I just confirmed that the bug is even there for FreeBSD 9 RC1 ! > > > > This is most unfortunate. Seriously. > > W00t, that sucks! You could migrate to another BSD (NetBSD) or Linux ... :) No, thanks;) > > I am running out of options, since I am willing to make my stuff > > Python 3 compatib

Re: Uninstalling Py 2.5.2 from Windows 7 (Invalid on Win 32 app)

2011-11-14 Thread W. eWatson
On 11/14/2011 10:00 AM, John Gordon wrote: In "W. eWatson" writes: I would think the install would make the association of py to Python, either IDLE or the interpreter. I would hope so too, however you did mention that you moved the python executable to a different directory and installed a

Re: Uninstalling Py 2.5.2 from Windows 7 (Invalid on Win 32 app)

2011-11-14 Thread John Gordon
In "W. eWatson" writes: > I would think the install would make the association of py to Python, > either IDLE or the interpreter. I would hope so too, however you did mention that you moved the python executable to a different directory and installed a newer version, so verifying that the .py

Re: Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Christian Heimes
Am 14.11.2011 18:46, schrieb Tobias Oberstein: > I just confirmed that the bug is even there for FreeBSD 9 RC1 ! > > This is most unfortunate. Seriously. W00t, that sucks! You could migrate to another BSD (NetBSD) or Linux ... :) > I am running out of options, since I am willing to make my stuff

Re: my new project, is this the right way?

2011-11-14 Thread Miki Tebeka
> since i'm mostly a new-bye for as regard databases, my idea is to use > sqlite at the beginning. > > Is that ok? I think sqlite3 makes sense since it's already there and has SQL interface. > is there any general tutorial of how to start developing a database? i > mean a general guide to data

AW: Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Tobias Oberstein
> > > > I need 50k sockets + 100 files. > > > > > > Thus, this is even more strange: the Python (a Twisted service) > > > > will happily accept 50k sockets, but as soon as you do open() a file, > > > > it'll > bail out. > > > > > A limit of 32k smells like a overflow in a signed int. Perhaps your

Re: Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Jon Clements
On Nov 14, 5:03 pm, Tobias Oberstein wrote: > > > I need 50k sockets + 100 files. > > > > Thus, this is even more strange: the Python (a Twisted service) will > > > happily accept 50k sockets, but as soon as you do open() a file, it'll > > > bail out. > > > A limit of 32k smells like a overflow i

Re: Uninstalling Py 2.5.2 from Windows 7 (Invalid on Win 32 app)

2011-11-14 Thread W. eWatson
On 11/14/2011 8:15 AM, John Gordon wrote: In "W. eWatson" writes: What application is associated with .py files? Application? Simple ones, including the one i put here that you removed to answer my question. Eh? I can't see anywhere that you mentioned your Windows settings as to what ap

Re: Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Christian Heimes
Am 14.11.2011 18:03, schrieb Tobias Oberstein: > This is unbelievable. > > I've just tested: the bug (in libc) is still there on FreeBSD 8.2 p3 ... both > on i386 > _and_ amd64. > > Now I'm f***d;( > > A last chance: is it possible to compile Python for not using libc fopen(), > but the Posix o

AW: Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Tobias Oberstein
> > I need 50k sockets + 100 files. > > > > Thus, this is even more strange: the Python (a Twisted service) will > > happily accept 50k sockets, but as soon as you do open() a file, it'll bail > > out. > > A limit of 32k smells like a overflow in a signed int. Perhaps your system is > able and co

Re: Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Christian Heimes
Am 14.11.2011 17:36, schrieb Tobias Oberstein: > This is a dedicated machine doing nothing else .. I'm monitoring global FD > usage > > sysctl kern.openfiles > > and it's way beyond the configured limit > > $ ulimit -n > 20 Apparently you did everything right here. Well, it was worth the t

AW: Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Tobias Oberstein
> I'm not familiar with BSD but Linux has similar Kernel options. The kernel > options might be *global* flags to set the total upper limit of open file > descriptors for the entire system, not for a single process. > Also on Linux "ulimit" doesn't display the fd limit. You have to use "ulimit > -

Re: my new project, is this the right way?

2011-11-14 Thread Jon Clements
On Nov 14, 10:41 am, Tracubik wrote: > Hi all, > i'm developing a new program. > Mission: learn a bit of database management > Idea: create a simple, 1 window program that show me a db of movies i've > seen with few (<10) fields (actors, name, year etc) > technologies i'll use: python + gtk > db:

Re: Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Christian Heimes
Am 14.11.2011 16:57, schrieb Tobias Oberstein: > I am trying to convince Python to open more than 32k files .. this is on > FreeBSD. > > Now I know I have to set appropriate limits .. I did: > > $ sysctl kern.maxfiles > kern.maxfiles: 204800 > $ sysctl kern.maxfilesperproc > kern.maxfilesperproc

Re: Uninstalling Py 2.5.2 from Windows 7 (Invalid on Win 32 app)

2011-11-14 Thread John Gordon
In "W. eWatson" writes: > > What application is associated with .py files? > Application? Simple ones, including the one i put here that you > removed to answer my question. Eh? I can't see anywhere that you mentioned your Windows settings as to what application is associated with .py files.

Py2.7/FreeBSD: maximum number of open files

2011-11-14 Thread Tobias Oberstein
I am trying to convince Python to open more than 32k files .. this is on FreeBSD. Now I know I have to set appropriate limits .. I did: $ sysctl kern.maxfiles kern.maxfiles: 204800 $ sysctl kern.maxfilesperproc kern.maxfilesperproc: 20 $ sysctl kern.maxvnodes kern.maxvnodes: 20 $ ulimit

Re: my new project, is this the right way?

2011-11-14 Thread Redcat
> since i'm mostly a new-bye for as regard databases, my idea is to use > sqlite at the beginning. > > Is that ok? any other db to start with? (pls don't say mysql or similar, > they are too complex and i'll use this in a second step) I know it's a lot of work to learn initially, but I would reco

Re: Uninstalling Py 2.5.2 from Windows 7 (Invalid on Win 32 app)

2011-11-14 Thread W. eWatson
On 11/14/2011 7:24 AM, John Gordon wrote: In "W. eWatson" writes: I just pushed aside the python25 folder by renaming it, and installed py 2.5.2. However, when I try to open the simplest of py programs with IDLE, I get an error from Win7. c:\Users\blah\...\junk.py is not a valid Win 32 app

Re: Uninstalling Py 2.5.2 from Windows 7 (Invalid on Win 32 app)

2011-11-14 Thread John Gordon
In "W. eWatson" writes: > I just pushed aside the python25 folder by renaming it, and installed py > 2.5.2. However, when I try to open the simplest of py programs with > IDLE, I get an error from Win7. > c:\Users\blah\...\junk.py is not a valid Win 32 app. Are you double-clicking on the .py

new cars2011,2012,2013

2011-11-14 Thread porxy
Honda Insight (2012) http://newscarsblogspotcom.blogspot.com/#!/2011/11/honda-insight-2012... Audi A2 concept (2011) http://newscarsblogspotcom.blogspot.com/#!/2011/11/audi-a2-concept-20... Infiniti FX designed by Sebastian Vettel (2011) http://newscarsblogspotcom.blogspot.com/#!/2011/11/infiniti-

Re: Trying to write beautifulsoup result to a file and get error message

2011-11-14 Thread Andreas Perstinger
On 2011-11-13 23:37, goldtech wrote: If I try: ... soup = BeautifulSoup(ft3) f = open(r'c:\NewFolder\clean4.html', "w") f.write(soup) f.close() I get error message: Traceback (most recent call last): File "C:\Documents and Settings\user01\Desktop\py\tb1a.py", line 203, in f.write(soup)

Re: my new project, is this the right way?

2011-11-14 Thread Chris Angelico
On Mon, Nov 14, 2011 at 9:41 PM, Tracubik wrote: > Hi all, > i'm developing a new program. > Mission: learn a bit of database management If your goal is to learn about databasing, then I strongly recommend a real database engine. > since i'm mostly a new-bye for as regard databases, my idea is t

Re: Multilevel dicts/arrays v. tuples as keys?

2011-11-14 Thread Peter Otten
Matej Cepl wrote: > Dne 11.11.2011 14:31, macm napsal(a): >> def Dicty( dict[k1][k2] ): > > When looking at this I returned to the question which currently rolls in > my mind: > > What's difference/advantage-disadvantage betweeng doing multi-level > dicts/arrays like this and using tuple as a ke

my new project, is this the right way?

2011-11-14 Thread Tracubik
Hi all, i'm developing a new program. Mission: learn a bit of database management Idea: create a simple, 1 window program that show me a db of movies i've seen with few (<10) fields (actors, name, year etc) technologies i'll use: python + gtk db: that's the question since i'm mostly a new-bye fo

Re: Multilevel dicts/arrays v. tuples as keys? [Was: Re: Get keys from a dicionary]

2011-11-14 Thread Tim Golden
On 14/11/2011 10:05, Matej Cepl wrote: Dne 11.11.2011 14:31, macm napsal(a): def Dicty( dict[k1][k2] ): When looking at this I returned to the question which currently rolls in my mind: What's difference/advantage-disadvantage betweeng doing multi-level dicts/arrays like this and using tuple

Multilevel dicts/arrays v. tuples as keys? [Was: Re: Get keys from a dicionary]

2011-11-14 Thread Matej Cepl
Dne 11.11.2011 14:31, macm napsal(a): def Dicty( dict[k1][k2] ): When looking at this I returned to the question which currently rolls in my mind: What's difference/advantage-disadvantage betweeng doing multi-level dicts/arrays like this and using tuple as a key? I.e., is it more Pythonic

Re: (n00b) Tkinter trouble

2011-11-14 Thread Chris Angelico
On Mon, Nov 14, 2011 at 6:11 PM, Jason Swails wrote: > Then, I can reactivate all of the buttons in the destroy() method before > calling the destroy() method of Toplevel on self. Small side point that might save you some work: Instead of disabling and enabling all the buttons, disable the whole