Re: File Path retrieving problem

2009-02-25 Thread Emile van Sebille
Peter Otten wrote: Maybe it's about access rights? $ mkdir alpha $ touch alpha/beta $ python -c"import os; print os.path.exists('alpha/beta')" True $ chmod u-x alpha $ python -c"import os; print os.path.exists('alpha/beta')" False $ I Don't know how this is handled on Windows... Here's one w

Re: "Battleship" style game

2009-02-25 Thread Grant Edwards
On 2009-02-25, Diez B. Roggisch wrote: > Don't waste time coding for a future you can't even pretend to > know. Do what is needed to solve the actual problem. Premature obfuscation is even worse than premature optimization. -- Grant Edwards grante Yow! Well, O.K.

Re: python sql query in django

2009-02-25 Thread Bruno Desthuilliers
May a écrit : On Feb 24, 10:36 am, "Diez B. Roggisch" wrote: Thanks for all your suggestions. From what I've experienced in Django and now that I know a little more about how Python functions, I will probably use a combination of PHP and Django, instead of trying to get Python to do the web po

Re: Python Image Library IOError - cannot find JPEG decoder?

2009-02-25 Thread OdarR
On 24 fév, 18:34, Dario Traverso wrote: > I've been trying to install the Python Image Library  (PIL) on my Mac   > OSX Leopard laptop, but have been running into some difficulties. > > I've built the library, using the included setup.py  script. The build   > summary checks out ok, and sounds the

Re: [Tutor] Accessing callers context from callee method

2009-02-25 Thread mobiledreamers
i found the solution This is my first attempt at memcaching html page using cheetah since cheetah render needs locals() i use getCallerInfo() to get the locals() and send to memcached let me know if it is possible to better do this *notice getCallerInfo * *utils.py* @log_time_func def renderpage(k

Re: "Battleship" style game

2009-02-25 Thread Jean-Paul Calderone
On Wed, 25 Feb 2009 15:54:46 -0500, Shawn Milochik wrote: On Wed, Feb 25, 2009 at 3:15 PM, Diez B. Roggisch wrote: Not really. The point about properties is that you *can* make attribute access trigger getter or setter code. But not that you do unless there is an actual reason for that. The

Re: variable length tuple assignment

2009-02-25 Thread Steven D'Aprano
Tim Chase wrote: > As an aside, as of the last time I read the PEP[1] on this, I > believe it exhausts (or attempts to exhaust) any iterator. IMHO, > I think this exhausting is a bad idea because it prevents things like > >def numbers(start=0): > i = start > while True: >yi

Re: python sql query in django

2009-02-25 Thread Diez B. Roggisch
I think Django is fabulous for the admin-interface, a simple text search and template inheritance. I will use Django for all of those. What I'm not getting an answer to and cannot find an example of is a complex search, where I have to retrieve data from multiple tables, combine the data, remove

Re: python sql query in django

2009-02-25 Thread Diez B. Roggisch
for a introduction to the multitude of query-options. I doubt that your rather simple m:n-relationship is covered there. s/is/isn't/ Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: variables bound in moudules are None when module is not completely imported

2009-02-25 Thread chrysn
On Wed, Feb 25, 2009 at 05:05:28PM -0200, Gabriel Genellina wrote: > I'd try to move all the global stuff in that module into a function, > "init". Importing the module will always succeed - you have to manually > call init() after importing it. i normally do that anyway and would also have do

logging.Handler not working with QThreads

2009-02-25 Thread Lukas Hetzenecker
Hello, I created a QTextEdit where I wanted to display log messages. A logging.Handler should do this job. It worked with one thread well, but when I start a QThread the text on all widgets is removed and I get many errors in my konsole: X Error: RenderBadGlyphSet (invalid GlyphSet parameter) 1

Re: This application has failed to start because the application configuration is incorrect

2009-02-25 Thread Mark Hammond
On 26/02/2009 4:51 AM, Lorenzo wrote: PS: Mark, this could be added to a kind of "Deployment" entry in py2exe wiki, it would be useful. IIRC, I've never edited the py2exe wiki (despite appearances to the contrary sometimes, I don't formally maintain that package!). But that is the cool thin

Re: PYTHONPATH on Mac 10.5

2009-02-25 Thread Philip Semanchuk
On Feb 25, 2009, at 3:20 PM, Vincent Davis wrote: I have looked around for a good howto setup PYTHONPATH on Mac os x 10.5 Although I get many results I am not sure which is correct. I am not sure if it is different for 10.5 over previous versions. Does anyone know of a well documented set

Re: reading file to list

2009-02-25 Thread Xah Lee
On Feb 25, 10:18 am, Xah Lee wrote: > On Feb 25, 3:34 am, nick_keighley_nos...@hotmail.com wrote: > > > the nasty cons then only appears in a single function which > > you can hide in a library > > I think the following answers that. > > Q: If you don't like cons, lisp has arrays and hashmaps, too

Re: pep 8 constants

2009-02-25 Thread Rhodri James
On Wed, 25 Feb 2009 08:48:27 -, Bruno Desthuilliers wrote: Ben Finney a écrit : (snip - about using ALL_CAPS for pseudo-constants) Perhaps I'd even argue for an update to PEP 8 that endorses this as conventional. +1 I've been a bit surprised last time I checked PEP8 to find out this

Re: variables bound in moudules are None when module is not completely imported

2009-02-25 Thread Gabriel Genellina
En Wed, 25 Feb 2009 21:24:33 -0200, escribió: On Wed, Feb 25, 2009 at 05:05:28PM -0200, Gabriel Genellina wrote: I'd try to move all the global stuff in that module into a function, "init". Importing the module will always succeed - you have to manually call init() after importing it. i nor

Re: Python Image Library IOError - cannot find JPEG decoder?

2009-02-25 Thread Zvezdan Petkovic
On Feb 24, 9:34 am, Dario Traverso wrote: I've been trying to install the Python Image Library (PIL) on my Mac OSX Leopard laptop, but have been running into some difficulties. ... I've followed all of the installation instructions exactly. The build summary reported everything was "ok". What c

Re: "Battleship" style game

2009-02-25 Thread Zvezdan Petkovic
On Feb 25, 2009, at 3:54 PM, Shawn Milochik wrote: It is true that it would be fewer lines of code with the same functionality, but it's better practice to have that framework in place so that any changes made in the future wouldn't break any of the code accessing my class. Obviously this is a fa

Is this the right way to use unicode in a user defined Exception?

2009-02-25 Thread 一首诗
# class MyError(Exception): def __init__(self): self.message = u'Some Chinese:中文' def __str__(self): return self.message.encode('utf8') # This is an exception that I defined.

thread safe to lock on key,val pairs on a dict instead of entire dict?

2009-02-25 Thread birdsong
Dictionaries just store references to objects, right? So is it thread safe to lock a specific key/val pair on a dictionary and modify its val and release the lock? example snippet: # assuming d_lock was initialized long ago in a thread-safe manner d_lock.acquire() d = {} d[1] = (threading.Lock()

Re: Using cPickle

2009-02-25 Thread mmcclaf
Thanks! All fixed! -- http://mail.python.org/mailman/listinfo/python-list

Re: File Path retrieving problem

2009-02-25 Thread music24by7
On Feb 26, 2:35 am, Emile van Sebille wrote: > Peter Otten wrote: > > Maybe it's about access rights? > > > $ mkdir alpha > > $ touch alpha/beta > > $ python -c"import os; print os.path.exists('alpha/beta')" > > True > > $ chmod u-x alpha > > $ python -c"import os; print os.path.exists('alpha/beta

Re: File Path retrieving problem

2009-02-25 Thread Steve Holden
music24...@gmail.com wrote: > On Feb 26, 2:35 am, Emile van Sebille wrote: >> Peter Otten wrote: >>> Maybe it's about access rights? >>> $ mkdir alpha >>> $ touch alpha/beta >>> $ python -c"import os; print os.path.exists('alpha/beta')" >>> True >>> $ chmod u-x alpha >>> $ python -c"import os; pri

Queries

2009-02-25 Thread mmcclaf
I have to make some queries for 4 tables I have. The following relations are: Classes(class, type, country, numGuns, bore, displacement) Ships (name, class, launched) Battles (name, date) Outcomes (ship, battle, result) The three queries I'm stuck on are the following: 1. Find the classes that

Re: File Path retrieving problem

2009-02-25 Thread music24by7
On Feb 26, 9:03 am, Steve Holden wrote: > music24...@gmail.com wrote: > > On Feb 26, 2:35 am, Emile van Sebille wrote: > >> Peter Otten wrote: > >>> Maybe it's about access rights? > >>> $ mkdir alpha > >>> $ touch alpha/beta > >>> $ python -c"import os; print os.path.exists('alpha/beta')" > >>>

Re: File Path retrieving problem

2009-02-25 Thread John Machin
On Feb 26, 3:16 pm, music24...@gmail.com wrote: > On Feb 26, 9:03 am, Steve Holden wrote: > > > > > music24...@gmail.com wrote: > > > On Feb 26, 2:35 am, Emile van Sebille wrote: > > >> Peter Otten wrote: > > >>> Maybe it's about access rights? > > >>> $ mkdir alpha > > >>> $ touch alpha/beta > >

Re: XML Parsing

2009-02-25 Thread hrishy
Ha the guru himself responding :-) --- On Wed, 25/2/09, Paul McGuire wrote: > From: Paul McGuire > Subject: Re: XML Parsing > To: python-list@python.org > Date: Wednesday, 25 February, 2009, 2:04 PM > On Feb 25, 1:17 am, hrishy > wrote: > > Hi > > > > Something like this > > > > > > > Note i

Re: XML Parsing

2009-02-25 Thread hrishy
Hi Cliff Thanks so using elementree is the right way to handle this problem regards Hrishy --- On Wed, 25/2/09, J. Clifford Dyer wrote: > From: J. Clifford Dyer > Subject: Re: XML Parsing > To: hris...@yahoo.co.uk > Cc: python-list@python.org, "Lie Ryan" > Date: Wednesday, 25 February, 2009

Re: Queries

2009-02-25 Thread Gary Herron
mmcclaf wrote: I have to make some queries for 4 tables I have. The following relations are: Classes(class, type, country, numGuns, bore, displacement) Ships (name, class, launched) Battles (name, date) Outcomes (ship, battle, result) The three queries I'm stuck on are the following: 1. Find

Re: PYTHONPATH on Mac 10.5

2009-02-25 Thread Python Nutter
+1 for site packages and standard shebang, still lets you launch with python first followed by .py file or followed by .py file also for some clues, just open up a terminal in your Mac OS X computer and check out your exports your PATH will be different depending on all the software and developme

class property not working in python 2.5.1

2009-02-25 Thread Dan Barbus
Hi, I have a problem with setting a property to a class instance, in python 2.5.1. The property is defined through get and set methods, but when I set it, the setter doesn't get called. Instead, I believe the property in the instance gets replaced with a new object (string). I have the following

Re: class property not working in python 2.5.1

2009-02-25 Thread Christian Heimes
Dan Barbus schrieb: > Hi, > > I have a problem with setting a property to a class instance, in > python 2.5.1. The property is defined through get and set methods, but > when I set it, the setter doesn't get called. Instead, I believe the > property in the instance gets replaced with a new object

<    1   2