Motorola Atrix review

2013-03-02 Thread 23alagmy
Motorola Atrix review

http://natigtas7ab.blogspot.com/2012/10/motorola-atrix-review.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Samsung Galaxy Mini

2013-03-02 Thread alagmy
Samsung Galaxy Mini

http://natigtas7ab.blogspot.com/2012/10/samsung-galaxy-mini.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread James Griffin
[- Sat  2.Mar'13 at 17:54:57 +1100  Chris Angelico :-]

> On Sat, Mar 2, 2013 at 5:09 PM, Devin Jeanpierre  
> wrote:
> > On Fri, Mar 1, 2013 at 10:54 PM, Chris Angelico  wrote:
> >>> No offence Chris, but you're the only person I know who *regularly*
> >>> replies to the wrong list. Does your mail client not have a "Reply to
> >>> List" command, or "Reply All"? If so, then you should use it rather than
> >>> manually typing the (wrong) list address in.
> >>
> >> Correct, Gmail doesn't. I should switch to Thunderbird (or something
> >> else, but I've heard a good many recommendations for Tbird) but have
> >> yet to get around to setting it up.
> >
> > Actually, it has a few ways to reply-to-all. In this screenshot, there
> > are three things I could click to reply-to-all:
> > http://imgur.com/914BNuY
> 
> Yes, but reply-all sends a copy to the poster as well as the list.
> What I want is reply-list, acknowledging the list headers... and Gmail
> simply doesn't have that.
> 
> I also want to be able to change my mind as to whether it's
> reply-all/reply-list/reply-sender after typing up a reply. Guess it's
> time I grabbed Tbird to find out if it can do that...

use mutt devel or [Al]pine. Text based MUA's and News readers are more 
efficient IMO.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to install development package on linux?

2013-03-02 Thread Kwpolska
On Sat, Mar 2, 2013 at 7:24 AM, Sarbjit singh  wrote:
> Sorry for this basic question but I am having problem compiling mod_wsgi on 
> Linux. As per mod_wsgi package site, user must have python development 
> package installed on system.
>
> I had installed Python2.7 on my Linux system from source code, using the 
> following configuration few months back :-
>
> ./configure –prefix= --enable-shared
> Make –i install
>
> But I am not able to find how to install development package from source code.
>
> Can some one please conform if I can install the development package from the 
> same source code (Downloaded from Python Website for Unix) and please share 
> the configuration switch for the same.
>
> Thanks,
> Sarbjit
> --
> http://mail.python.org/mailman/listinfo/python-list

Why do you use source tarballs?  Your distro should provide nice
binary packages for Python and mod_wsgi.  And in case it doesn’t, your
distro sucks and you should find a better one.

The development things are usually installed by default by most
things.  Distributions offer them in -dev or -devel packages.

--
Kwpolska  | GPG KEY: 5EAAEA16
stop html mail| always bottom-post
http://asciiribbon.org| http://caliburn.nl/topposting.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Having problems crashing IDLE

2013-03-02 Thread Peter Otten
Quintessence wrote:

> Thank you for the advice! I checked the setting you specified and "Open
> Shell Window" at startup was already selected. Is there another bug this
> could be related to?

None that I and google could find. Close idle and remove (or rename) the 
.idlerc directory in your home folder, and then start Idle again. 

If the problem persists it is very unlikely that it is configuration-
related. In that case I suggest that you file a bug report yourself or amend 
your observations to the existing one.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best way to convert number of minutes to hh:mm AM/PM?

2013-03-02 Thread andydtaylor
Brilliant, thanks to all
-- 
http://mail.python.org/mailman/listinfo/python-list


GeoBases V5 beta release

2013-03-02 Thread geobases . dev

Hello!

We just released the new beta version of GeoBases.

For those who do not know GeoBases, this project provides tools to play with 
geographical data. It also works with non-geographical data, except for map 
visualizations :).

There are embedded data sources in the project, but you can easily play with 
your own data in addition to the available ones. After data loading, you can:

 - perform various types of queries (find this key, or find keys with this 
property)
 - make fuzzy searches based on string distance (find things roughly named like 
this)
 - make phonetic searches (find things sounding like this)
 - make geographical searches (find things next to this place)
 - get results on a map, or on a graph, or export it as csv data, or as a 
Python object

A few highlights of this new version:
 - sub-indexes
 - join clauses
 - better zsh autocomplete
 - sources admin mode
 - beginner's mode 
 - phonetic search
 - graph display

Get the code from Github https://github.com/opentraveldata/geobases
Get the latest news from https://twitter.com/GeoBasesDev/

If you like it, share it!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread Devin Jeanpierre
On Sat, Mar 2, 2013 at 1:54 AM, Chris Angelico  wrote:
> Yes, but reply-all sends a copy to the poster as well as the list.
> What I want is reply-list, acknowledging the list headers... and Gmail
> simply doesn't have that.

I've been replying to the poster and the list for ages. Is it bad netiquette?

> I also want to be able to change my mind as to whether it's
> reply-all/reply-list/reply-sender after typing up a reply. Guess it's
> time I grabbed Tbird to find out if it can do that...

You can change your mind for reply-all/reply/forward in gmail, but
since there's no reply-list, can't do that one, of course.

-- Devin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread Tim Golden

On 02/03/2013 14:53, Devin Jeanpierre wrote:

On Sat, Mar 2, 2013 at 1:54 AM, Chris Angelico  wrote:

Yes, but reply-all sends a copy to the poster as well as the list.
What I want is reply-list, acknowledging the list headers... and Gmail
simply doesn't have that.


I've been replying to the poster and the list for ages. Is it bad netiquette?


Mixed, I'd say. Some do it, some even prefer it, some don't. I generally 
stick to the list only unless it's important that the OP sees the 
message sooner than later.


TJG

--
http://mail.python.org/mailman/listinfo/python-list


Is it correct this way to inherit from a list?

2013-03-02 Thread gialloporpora

Hi all,
I would like to inherit from the list native class.
really I expected that was possible to use native list method without 
redefining them, for example the __repr__ method.


I don't know if i have made something wrong, this is my code (I obmit 
customized methods that I have added):


from os.path import exists

class vector(list):
def __init__(self, *args):
self._list = list(args)
self._index = 0
def __getitem__(self, key):
return self._list[key]

def __setitem__(self, key, value):
self._list[key] = value
def __len__(self):
return len(self._list)
def __iter__(self):
return self
def next(self):
if self._index == len(self):
self._index = 0
raise StopIteration
next = self._index
self._index += 1
return self[next

Is it correct or it exists another way to inherit from list class?


Sandro




--
http://mail.python.org/mailman/listinfo/python-list


Re: Is it correct this way to inherit from a list?

2013-03-02 Thread Peter Otten
gialloporpora wrote:

> I would like to inherit from the list native class.
> really I expected that was possible to use native list method without
> redefining them, for example the __repr__ method.
> 
> I don't know if i have made something wrong, this is my code (I obmit
> customized methods that I have added):
> 
> from os.path import exists
> 
> class vector(list):

> def __getitem__(self, key):
> return self._list[key]

[and many more]

> Is it correct or it exists another way to inherit from list class?

Have you considered subclassing collections.MutableSequence instead?
You cannot instantiate that class until you have overridden all its abstract 
methods.

-- 
http://mail.python.org/mailman/listinfo/python-list


Sorting (deeply) nested lists

2013-03-02 Thread mamboknave
I cannot resolve this on my own. Need help, please...

nestedTuples = [
[ (L0t0e0, L0t0e1, L0t0e2), (L0t1e0, 2, L0t1e2), (L0t2e0, L0t2e1, L0t2e2) ],
[ (L1t0e0, L1t0e1, L1t0e2), (L1t1e0, 0, L1t1e2), (L1t2e0, L1t2e1, L1t2e2) ],
[ (L2t0e0, L2t0e1, L2t0e2), (L2t1e0, 1, L2t1e2), (L2t2e0, L2t2e1, L2t2e2) ] ]

With LNtXeY I mean the element Y in the tuple X of the list N.

How can I sort nestedTuples by, say, the 2nd element in the 2nd tuple of each 
list?

The above should get sorted as :

nestedTuples = [
[ (L1t0e0, L1t0e1, L1t0e2), (L1t1e0, 0, L1t1e2), (L1t2e0, L1t2e1, L1t2e2) ],
[ (L2t0e0, L2t0e1, L2t0e2), (L2t1e0, 1, L2t1e2), (L2t2e0, L2t2e1, L2t2e2) ],
[ (L0t0e0, L0t0e1, L0t0e2), (L0t1e0, 2, L0t1e2), (L0t2e0, L0t2e1, L0t2e2) ] ]

Thanks so much!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is it correct this way to inherit from a list?

2013-03-02 Thread Ian Kelly
On Sat, Mar 2, 2013 at 10:22 AM, Ian Kelly  wrote:
> class Vector(list):
> def __new__(cls, *args):
> return super(Vector, cls).__new__(cls, args)
> def __init__(self, *args):
> super(Vector, self).__init__(args)
>
> The __new__ method here will receive the args in the style that you
> want, and then pass them up the inheritance chain to the superclass
> constructor, which will then just do the right thing.  The __init__
> method is also overridden to match the modified argspec.  The
> super().__init__() call is included for completeness; AFAIK it doesn't
> actually do anything.

I retract that.  On further testing, it is actually the __init__
method that initializes the list contents, not the __new__ method.  So
this is all you need:

class Vector(list):
def __init__(self, *args):
super(Vector, self).__init__(args)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is it correct this way to inherit from a list?

2013-03-02 Thread Ian Kelly
On Sat, Mar 2, 2013 at 10:02 AM, gialloporpora  wrote:
> Hi all,
> I would like to inherit from the list native class.
> really I expected that was possible to use native list method without
> redefining them, for example the __repr__ method.
>
> I don't know if i have made something wrong, this is my code (I obmit
> customized methods that I have added):
>
> from os.path import exists
>
> class vector(list):
> def __init__(self, *args):
> self._list = list(args)

So here you have a list subclass, but instead of taking advantage of
that is-a relationship, you're creating a secondary list from the
arguments and attaching it to self._list in a has-a relationship.  The
net effect is that you actually have two separate list objects here,
with some methods operating on the list itself and some operating on
the attached list.  Try this instead:

class Vector(list):
def __new__(cls, *args):
return super(Vector, cls).__new__(cls, args)
def __init__(self, *args):
super(Vector, self).__init__(args)

The __new__ method here will receive the args in the style that you
want, and then pass them up the inheritance chain to the superclass
constructor, which will then just do the right thing.  The __init__
method is also overridden to match the modified argspec.  The
super().__init__() call is included for completeness; AFAIK it doesn't
actually do anything.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sorting (deeply) nested lists

2013-03-02 Thread Peter Otten
mambokn...@gmail.com wrote:

> I cannot resolve this on my own. Need help, please...
> 
> nestedTuples = [
> [ (L0t0e0, L0t0e1, L0t0e2), (L0t1e0, 2, L0t1e2), (L0t2e0, L0t2e1, L0t2e2)
> [ ], (L1t0e0, L1t0e1, L1t0e2), (L1t1e0, 0, L1t1e2), (L1t2e0, L1t2e1,
> [ L1t2e2) ], (L2t0e0, L2t0e1, L2t0e2), (L2t1e0, 1, L2t1e2), (L2t2e0,
> [ L2t2e1, L2t2e2) ] ]
> 
> With LNtXeY I mean the element Y in the tuple X of the list N.
> 
> How can I sort nestedTuples by, say, the 2nd element in the 2nd tuple of
> each list?

def getkey(item):
return item[1][1]
namedTuples.sort(key=getkey)

You can also write this as

namedTuples.sort(key=lambda item: item[1][1])

> The above should get sorted as :
> 
> nestedTuples = [
> [ (L1t0e0, L1t0e1, L1t0e2), (L1t1e0, 0, L1t1e2), (L1t2e0, L1t2e1, L1t2e2)
> [ ], (L2t0e0, L2t0e1, L2t0e2), (L2t1e0, 1, L2t1e2), (L2t2e0, L2t2e1,
> [ L2t2e2) ], (L0t0e0, L0t0e1, L0t0e2), (L0t1e0, 2, L0t1e2), (L0t2e0,
> [ L0t2e1, L0t2e2) ] ]


-- 
http://mail.python.org/mailman/listinfo/python-list


Dealing with exceptions

2013-03-02 Thread bvdp
Every time I write a program with exception handling (and I suppose that 
includes just about every program I write!) I need to scratch my brain when I 
create try blocks.

For example, I'm writing a little program do copy specific files to a USB 
stick. To do the actual copy I'm using:

try:
   shutil.copy(s, os.path.join(usbpath, songname))
 except ...

now, I need to figure out just what exceptions to handle. Let's see: 

  IOError  that means that the disk is full or otherwise buggered. Better dump 
out of the loop.

But, I know there can be other errors as well. Doing some tests, I know that 
certain filenames are invalid (I think a "?" or unicode char is invalid when 
writing to a FAT32 filesystem). And, so what exception is that? Without 
actually creating the error, I can't figure it out.

In this case, I can run the program an number of times and parse out the errors 
and write code to catch various things. But, I think I'm missing something 
completely. Guess what I'm looking for is a list of possible (probable?) errors 
for the shutil.copy() command. And, in a much bigger manual, for most other 
commands.

Maybe I'm just venting about FAT32 filesystems :)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sorting (deeply) nested lists

2013-03-02 Thread mamboknave
On Saturday, March 2, 2013 9:36:43 AM UTC-8, Peter Otten wrote:
>
> You can also write this as
> 
> namedTuples.sort(key=lambda item: item[1][1])
>

That's exactly what I did before and got "IndexError: list index out of range".

So, I thought my lambda was wrong and posted here.

Now, having seen you reply, I dug deeper and... of course I had IndexError: the 
list was horribly empty!

Thanks so much for replying so quickly, Peter!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is it correct this way to inherit from a list?

2013-03-02 Thread Rick Johnson
On Saturday, March 2, 2013 11:02:14 AM UTC-6, gialloporpora wrote:

> I would like to inherit from the list native class. really
> I expected that was possible to use native list method
> without redefining them, for example the __repr__ method.
> 
> [...]
>
> class vector(list):
>   def __init__(self, *args):
>   self._list = list(args)
>   self._index = 0

Here is where you go wrong. 

First of all why would you inherit from "list" and then create a new list as 
attribute, that seems a bit silly huh? If you want your custom list to 
"inherit" all the pre-defined methods of the python list type, then do so.

>>> class MyList(list):
pass

>>> ml = MyList()
>>> dir(ml)
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', 
'__delslice__', '__dict__', '__doc__', '__eq__', '__format__', '__ge__', 
'__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', 
'__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', 
'__module__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', 
'__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', 
'__setslice__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 
'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 
'sort']
>>> ml
[]
>>> ml.append('cat')
>>> ml
['cat']
>>> ml.extend(range(5))
>>> ml
['cat', 0, 1, 2, 3, 4]
>>> ml.sort()
>>> ml
[0, 1, 2, 3, 4, 'cat']
>>> isinstance(ml, list)
True

Quacks like a list to me. In this case you did not need to call the superclass 
constructor explicitly; for example.

class MyList(list):
def __init__(self):
list.__init__(self)

...is really a waste of time because you will not have any options to pass to 
the super. 

>>> ml2 = MyList2()
>>> dir(ml2)
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', 
'__delslice__', '__dict__', '__doc__', '__eq__', '__format__', '__ge__', 
'__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', 
'__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', 
'__module__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', 
'__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', 
'__setslice__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 
'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 
'sort']
>>> ml2+[10,20,30]
[10, 20, 30]
>>> ml2
[]
>>> ml2.append('salt')
>>> ml2
['salt']
>>> isinstance(ml2, list)
True

If however you wanted to create a custom Tkinter widget, you would then need to 
pass the options from the derived class __init__ method into the superclass 
__init__ method, like this:

class MyButton(tk.Button):
def __init__(self, master, **kw):
tk.Button.__init__(self, master, **kw)

mb = MyButton(rootWindow, text='PushMe', command=helloButton)

What are you trying to achieve exactly? 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Kwpolska
On Sat, Mar 2, 2013 at 6:40 PM, bvdp  wrote:
> Every time I write a program with exception handling (and I suppose that 
> includes just about every program I write!) I need to scratch my brain when I 
> create try blocks.
>
> For example, I'm writing a little program do copy specific files to a USB 
> stick. To do the actual copy I'm using:
>
> try:
>shutil.copy(s, os.path.join(usbpath, songname))
>  except ...
>
> now, I need to figure out just what exceptions to handle. Let's see:
>
>   IOError  that means that the disk is full or otherwise buggered. Better 
> dump out of the loop.
>
> But, I know there can be other errors as well. Doing some tests, I know that 
> certain filenames are invalid (I think a "?" or unicode char is invalid when 
> writing to a FAT32 filesystem). And, so what exception is that? Without 
> actually creating the error, I can't figure it out.
>
> In this case, I can run the program an number of times and parse out the 
> errors and write code to catch various things. But, I think I'm missing 
> something completely. Guess what I'm looking for is a list of possible 
> (probable?) errors for the shutil.copy() command. And, in a much bigger 
> manual, for most other commands.
>
> Maybe I'm just venting about FAT32 filesystems :)
>
> --
> http://mail.python.org/mailman/listinfo/python-list

IOError and OSError should cover all copy problems, I think.

Also, you can do `except:` for a catch-all, but it is discouraged
unless you have REALLY good reasons to do this.  And, most of the
time, you don’t.

-- 
Kwpolska  | GPG KEY: 5EAAEA16
stop html mail| always bottom-post
http://asciiribbon.org| http://caliburn.nl/topposting.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Ian Kelly
On Sat, Mar 2, 2013 at 10:40 AM, bvdp  wrote:
> Every time I write a program with exception handling (and I suppose that 
> includes just about every program I write!) I need to scratch my brain when I 
> create try blocks.
>
> For example, I'm writing a little program do copy specific files to a USB 
> stick. To do the actual copy I'm using:
>
> try:
>shutil.copy(s, os.path.join(usbpath, songname))
>  except ...
>
> now, I need to figure out just what exceptions to handle. Let's see:
>
>   IOError  that means that the disk is full or otherwise buggered. Better 
> dump out of the loop.
>
> But, I know there can be other errors as well. Doing some tests, I know that 
> certain filenames are invalid (I think a "?" or unicode char is invalid when 
> writing to a FAT32 filesystem). And, so what exception is that? Without 
> actually creating the error, I can't figure it out.

OSError.  In Python 3, I expect it would more specifically be a
FileNotFoundError, which is a subclass of OSError.

> In this case, I can run the program an number of times and parse out the 
> errors and write code to catch various things. But, I think I'm missing 
> something completely. Guess what I'm looking for is a list of possible 
> (probable?) errors for the shutil.copy() command. And, in a much bigger 
> manual, for most other commands.

OSError will cover a wide swath of possible exceptions here.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to install development package on linux?

2013-03-02 Thread Sarbjit singh
On Saturday, March 2, 2013 2:15:08 PM UTC+5:30, Kwpolska wrote:
> On Sat, Mar 2, 2013 at 7:24 AM, Sarbjit singh  wrote:
> 
> > Sorry for this basic question but I am having problem compiling mod_wsgi on 
> > Linux. As per mod_wsgi package site, user must have python development 
> > package installed on system.
> 
> >
> 
> > I had installed Python2.7 on my Linux system from source code, using the 
> > following configuration few months back :-
> 
> >
> 
> > ./configure –prefix= --enable-shared
> 
> > Make –i install
> 
> >
> 
> > But I am not able to find how to install development package from source 
> > code.
> 
> >
> 
> > Can some one please conform if I can install the development package from 
> > the same source code (Downloaded from Python Website for Unix) and please 
> > share the configuration switch for the same.
> 
> >
> 
> > Thanks,
> 
> > Sarbjit
> 
> > --
> 
> > http://mail.python.org/mailman/listinfo/python-list
> 
> 
> 
> Why do you use source tarballs?  Your distro should provide nice
> 
> binary packages for Python and mod_wsgi.  And in case it doesn’t, your
> 
> distro sucks and you should find a better one.
> 
> 
> 
> The development things are usually installed by default by most
> 
> things.  Distributions offer them in -dev or -devel packages.
> 
> 
> 
> --
> 
> Kwpolska  | GPG KEY: 5EAAEA16
> 
> stop html mail| always bottom-post
> 
> http://asciiribbon.org| http://caliburn.nl/topposting.html

I am using Red Hat 5, could you please give some pointers on how to install 
these packages?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Ian Kelly
On Sat, Mar 2, 2013 at 10:52 AM, Kwpolska  wrote:
> IOError and OSError should cover all copy problems, I think.

And it may be worth pointing out here that as of Python 3.3, IOError
is just a synonym for OSError.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Chris Angelico
On Sun, Mar 3, 2013 at 4:40 AM, bvdp  wrote:
> For example, I'm writing a little program do copy specific files to a USB 
> stick. To do the actual copy I'm using:
>
> try:
>shutil.copy(s, os.path.join(usbpath, songname))
>  except ...
>
> now, I need to figure out just what exceptions to handle.

Here's a bit of a left-field thought: Maybe none of them.

What are you actually doing when you get an exception? Can you
plausibly recover? If not - that is, if you're going to abort the
whole operation anyway - then save yourself the trouble of writing the
try/catch, and just let the exception propagate up (to the console, if
nowhere else).

On the other hand, if you want to simply report the error and continue
on (meaning you get as many songs copied as possible), then do what
others have recommended and catch OSError.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


صور white LG nexus 4 egypt نيكسس 4 الأبيض

2013-03-02 Thread 23alagmy
صور white LG nexus 4 egypt نيكسس 4 الأبيض

http://natigtas7ab.blogspot.com/2013/02/white-lg-nexus-4-egypt-4.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Mark Lawrence

On 02/03/2013 17:58, Ian Kelly wrote:

On Sat, Mar 2, 2013 at 10:40 AM, bvdp  wrote:

Every time I write a program with exception handling (and I suppose that 
includes just about every program I write!) I need to scratch my brain when I 
create try blocks.

For example, I'm writing a little program do copy specific files to a USB 
stick. To do the actual copy I'm using:

 try:
shutil.copy(s, os.path.join(usbpath, songname))
  except ...

now, I need to figure out just what exceptions to handle. Let's see:

   IOError  that means that the disk is full or otherwise buggered. Better dump 
out of the loop.

But, I know there can be other errors as well. Doing some tests, I know that certain 
filenames are invalid (I think a "?" or unicode char is invalid when writing to 
a FAT32 filesystem). And, so what exception is that? Without actually creating the error, 
I can't figure it out.


OSError.  In Python 3, I expect it would more specifically be a
FileNotFoundError, which is a subclass of OSError.


This wasn't introduced until Python 3.3 see 
http://docs.python.org/3/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy





In this case, I can run the program an number of times and parse out the errors 
and write code to catch various things. But, I think I'm missing something 
completely. Guess what I'm looking for is a list of possible (probable?) errors 
for the shutil.copy() command. And, in a much bigger manual, for most other 
commands.


OSError will cover a wide swath of possible exceptions here.




--
Cheers.

Mark Lawrence

--
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread bvdp

> 
> IOError and OSError should cover all copy problems, I think.

How do you know that? I can figure it out as well by running the program, but 
I'd like to make the determination of what to catch when I'm writing the code.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Devin Jeanpierre
On Sat, Mar 2, 2013 at 1:21 PM, Chris Angelico  wrote:
>> now, I need to figure out just what exceptions to handle.
>
> Here's a bit of a left-field thought: Maybe none of them.
>
> What are you actually doing when you get an exception? Can you
> plausibly recover? If not - that is, if you're going to abort the
> whole operation anyway - then save yourself the trouble of writing the
> try/catch, and just let the exception propagate up (to the console, if
> nowhere else).

He can't know if he should handle the errors if he doesn't know what
those errors are. Thus the question.

-- Devin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread bvdp

> 
> Here's a bit of a left-field thought: Maybe none of them.
> 

Not far left at all :)
> 
> What are you actually doing when you get an exception? Can you
> 
> plausibly recover? If not - that is, if you're going to abort the
> 
> whole operation anyway - then save yourself the trouble of writing the
> 
> try/catch, and just let the exception propagate up (to the console, if
> 
> nowhere else).
> 

My first cut of the program did exactly that. Just abort the whole thing, 
figuring that the disk was full or buggered.

What I ran into was that half way through the process I ended up with a 
filename which the FAT32 didn't like. So, my brain-dead idea was to catch those 
(and ignore them) and continue on. But then I have to distinguish between a bad 
filename and "real" errors.

But, you are probably correct if you say I should check the filename first :) 
Is there a module for that?


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Rick Johnson
On Saturday, March 2, 2013 11:40:11 AM UTC-6, bvdp wrote:
> Every time I write a program with exception handling (and
> I suppose that includes just about every program I write!)
> I need to scratch my brain when I create try blocks.
> 
> For example, I'm writing a little program do copy specific
> files to a USB stick. To do the actual copy I'm using:
> 
> try:
>shutil.copy(s, os.path.join(usbpath, songname))
>  except ...
> 
> now, I need to figure out just what exceptions to handle.
> Let's see:
> 
> IOError  that means that the disk is full or otherwise
> buggered. Better dump out of the loop.
> 
> But, I know there can be other errors as well. Doing some
> tests, I know that certain filenames are invalid (I think
> a "?" or unicode char is invalid when writing to a FAT32
> filesystem). And, so what exception is that? Without
> actually creating the error, I can't figure it out.

Well how can you expect an error to be thrown without creating the scenario 
that will throw one? *wink*

> In this case, I can run the program an number of times and
> parse out the errors and write code to catch various
> things. But, I think I'm missing something completely.
> Guess what I'm looking for is a list of possible
> (probable?) errors for the shutil.copy() command. And, in
> a much bigger manual, for most other commands.

No. What you are doing is *misunderstanding* that well written methods must 
follow the values of:

 "doing one thing and doing it well"
 
In the case of "shutil.copy", that "one thing" is "coping files"; but that "one 
thing" does NOT include: 

 * resolving file paths
 * validating file path chars on an OS by OS basis
 * ensuring disc space is adequate
 * etc...

Methods that take inputs, like in this case: "src" and "dst" file paths, should 
not be responsible for the validity of the inputs. It is the responsibility of 
the caller to validate these inputs PRIOR to injecting them into the method. 

But even *IF* a convincing argument could be made for methods to validate 
inputs, then at what point do we draw the line? How many foolish samples of the 
possible permutation set should we consider? Should we inform the user of such 
foolish usage as:

 shutil.copy(src=1, dst=2, follow_symlinks=isinstance)
 shutil.copy(src='cat', dst='hat', follow_symlinks=list)

Now whilst these example are quite absurd, they are in-fact possibilities that 
must be considered *IF* we intend to follow your "wish" until it's logical 
conclusion.

-- 
http://mail.python.org/mailman/listinfo/python-list


Fwd: How to install development package on linux?

2013-03-02 Thread Kwpolska
On Sat, Mar 2, 2013 at 7:00 PM, Sarbjit singh  wrote:
> On Saturday, March 2, 2013 2:15:08 PM UTC+5:30, Kwpolska wrote:
>> On Sat, Mar 2, 2013 at 7:24 AM, Sarbjit singh  wrote:
>>
>> > Sorry for this basic question but I am having problem compiling mod_wsgi 
>> > on Linux. As per mod_wsgi package site, user must have python development 
>> > package installed on system.
>>
>> >
>>
>> > I had installed Python2.7 on my Linux system from source code, using the 
>> > following configuration few months back :-
>>
>> >
>>
>> > ./configure –prefix= --enable-shared
>>
>> > Make –i install
>>
>> >
>>
>> > But I am not able to find how to install development package from source 
>> > code.
>>
>> >
>>
>> > Can some one please conform if I can install the development package from 
>> > the same source code (Downloaded from Python Website for Unix) and please 
>> > share the configuration switch for the same.
>>
>> >
>>
>> > Thanks,
>>
>> > Sarbjit
>>
>> > --
>>
>> > http://mail.python.org/mailman/listinfo/python-list
>>
>>
>>
>> Why do you use source tarballs?  Your distro should provide nice
>>
>> binary packages for Python and mod_wsgi.  And in case it doesn’t, your
>>
>> distro sucks and you should find a better one.
>>
>>
>>
>> The development things are usually installed by default by most
>>
>> things.  Distributions offer them in -dev or -devel packages.
>>
>>
>>
>> --
>>
>> Kwpolska  | GPG KEY: 5EAAEA16
>>
>> stop html mail| always bottom-post
>>
>> http://asciiribbon.org| http://caliburn.nl/topposting.html
>
> I am using Red Hat 5, could you please give some pointers on how to install 
> these packages?
> --
> http://mail.python.org/mailman/listinfo/python-list

Impossible, unless you:
(a) build such packages yourself (Fedora .spec files may help you); or
(b) upgrade to RHEL 6, which offers packages for python 2.6 and mod_wsgi; or
(c) look for such packages on the Internet (you probably won’t find any).

So, get back to compiling from source.  Have you actually tried
building those packages before asking?  Because, according to the Arch
Linux PKGBUILDs for python2 and mod_wsgi2, it doesn’t have any
specific switches to enable anything “devel-related” (also, Arch Linux
doesn’t bother with the dumb -dev(el) packages, which make no sense in
real life).

-- 
Kwpolska  | GPG KEY: 5EAAEA16
stop html mail| always bottom-post
http://asciiribbon.org| http://caliburn.nl/topposting.html
-- 
http://mail.python.org/mailman/listinfo/python-list


good mail readers [was Re: [Python-ideas] string.format() default variable assignment]

2013-03-02 Thread Ethan Furman

On 03/02/2013 12:06 AM, James Griffin wrote:

[- Sat  2.Mar'13 at 17:54:57 +1100  Chris Angelico :-]

I also want to be able to change my mind as to whether it's
reply-all/reply-list/reply-sender after typing up a reply. Guess it's
time I grabbed Tbird to find out if it can do that...


use mutt devel or [Al]pine. Text based MUA's and News readers are more 
efficient IMO.


I'll take a look at those three.  While I certainly prefer Tbird over anything MS has to offer, it certainly has its own 
list of irritations.


--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: Issue with continous incrementing of unbroken sequence for a entire working day

2013-03-02 Thread Morten Engvoldsen
Hi,
Thanks to all.. this is great forum with so many good people. I have
learnt a lot of Python from this forum. Hope one day i will learn
enough that i can start answering in this forum.. :) Thanks again..
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Terry Reedy

On 3/2/2013 12:40 PM, bvdp wrote:


But, I know there can be other errors as well. Doing some tests, I
know that certain filenames are invalid (I think a "?" or unicode
char is invalid when writing to a FAT32 filesystem). And, so what
exception is that? Without actually creating the error, I can't
figure it out.


So use the interactive interpreter (or idle, or ipython) and create the 
error. You should always have it open when editing. Using less time that 
it took you to write the above. 3.3, win7, (idle)


>>> open('sdjhfjshdfkjsh')
Traceback (most recent call last):
  File "", line 1, in 
open('sdjhfjshdfkjsh')
FileNotFoundError: [Errno 2] No such file or directory: 'sdjhfjshdfkjsh'

Now, does shutil pass on FileNotFoundError? I will let you experiment.

There are error conditions that are hard to generate, but a bad file 
name is not one of them.


--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tk MouseWheel Support

2013-03-02 Thread enidoku
that code and other mousewheel code arent working on my pc

running windows 7 32bit python 2.6 and Mouse USB

whats the solution ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Chris Angelico
On Sun, Mar 3, 2013 at 8:23 AM, Terry Reedy  wrote:
 open('sdjhfjshdfkjsh')
> Traceback (most recent call last):
>   File "", line 1, in 
> open('sdjhfjshdfkjsh')
> FileNotFoundError: [Errno 2] No such file or directory: 'sdjhfjshdfkjsh'
>
> Now, does shutil pass on FileNotFoundError? I will let you experiment.
>
> There are error conditions that are hard to generate, but a bad file name is
> not one of them.

That's actually a perfectly valid file name, but one that doesn't
happen to have a corresponding file. However, the same technique will
work with the OP's description of "a filename which the FAT32 didn't
like" too.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IMAP4_SSL and OpenSSL compatibility

2013-03-02 Thread Matej Cepl
On 2013-02-26, 16:57 GMT, W. Martin Borgert wrote:
>   1. Is there any plan to backport this Python >= 3.3 feature to
>  Python 2?

No, development of Python 2 ceased to exist (only important bugfixes or 
security fix will happen, IIRC)

If you need advanced use of SSL, use pyOpenSSL (it has been ported to 
Python 3 already, so you won't loose any compatibility).

Matěj
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tk MouseWheel Support

2013-03-02 Thread Mark Lawrence

On 02/03/2013 21:47, enid...@gmail.com wrote:

that code and other mousewheel code arent working on my pc

running windows 7 32bit python 2.6 and Mouse USB

whats the solution ?



Post something that we can read, or do I give up on Thunderbird? :)

--
Cheers.

Mark Lawrence

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tk MouseWheel Support

2013-03-02 Thread Chris Angelico
On Sun, Mar 3, 2013 at 10:01 AM, Mark Lawrence  wrote:
> On 02/03/2013 21:47, enid...@gmail.com wrote:
>>
>> that code and other mousewheel code arent working on my pc
>>
>> running windows 7 32bit python 2.6 and Mouse USB
>>
>> whats the solution ?
>>
>
> Post something that we can read, or do I give up on Thunderbird? :)

I don't think Thunderbird's at fault here, unless it damaged the
original post itself. Is that a known bug? "Reading posts in
Thunderbird while the moon is in its first quarter and pigs are flying
overhead causes the OP to lose 40 points of apparent IQ"?

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Terry Reedy

On 3/2/2013 5:16 PM, Chris Angelico wrote:

On Sun, Mar 3, 2013 at 8:23 AM, Terry Reedy  wrote:

open('sdjhfjshdfkjsh')

Traceback (most recent call last):
   File "", line 1, in 
 open('sdjhfjshdfkjsh')
FileNotFoundError: [Errno 2] No such file or directory: 'sdjhfjshdfkjsh'

Now, does shutil pass on FileNotFoundError? I will let you experiment.

There are error conditions that are hard to generate, but a bad file name is
not one of them.


That's actually a perfectly valid file name, but one that doesn't
happen to have a corresponding file. However, the same technique will
work with the OP's description of "a filename which the FAT32 didn't
like" too.


Yeah, that gives a different error and message.
>>> open('a~`!@#$%^&*()_-+={[}]|\<,>.?/')
Traceback (most recent call last):
  File "", line 1, in 
open('a~`!@#$%^&*()_-+={[}]|\<,>.?/')
OSError: [Errno 22] Invalid argument: 'a~`!@#$%^&*()_-+={[}]|\\<,>.?/'


--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tk MouseWheel Support

2013-03-02 Thread Terry Reedy

On 3/2/2013 6:01 PM, Mark Lawrence wrote:

On 02/03/2013 21:47, enid...@gmail.com wrote:

that code and other mousewheel code arent working on my pc
running windows 7 32bit python 2.6 and Mouse USB
whats the solution ?



Post something that we can read, or do I give up on Thunderbird? :)


In tbird, temporarily switching from view/threads/unread to 
view/threads/all will expose older posts retained on your system, but 
enidoku appears to be replying to a post more than 180 days old (my 
retention period for this group). So more info is needed.


--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tk MouseWheel Support

2013-03-02 Thread Dave Angel

On 03/02/2013 06:01 PM, Mark Lawrence wrote:

On 02/03/2013 21:47, enid...@gmail.com wrote:

that code and other mousewheel code arent working on my pc

running windows 7 32bit python 2.6 and Mouse USB

whats the solution ?



Post something that we can read, or do I give up on Thunderbird? :)



That enidoku person was replying to a two-year old thread.  If you want 
to see the thread, check out:


http://www.velocityreviews.com/forums/t744913-tk-mousewheel-support.html

--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Chris Angelico
On Sun, Mar 3, 2013 at 10:08 AM, Terry Reedy  wrote:
> On 3/2/2013 5:16 PM, Chris Angelico wrote:
>>
>> On Sun, Mar 3, 2013 at 8:23 AM, Terry Reedy  wrote:
>>
>> open('sdjhfjshdfkjsh')
>>>
>>> Traceback (most recent call last):
>>>File "", line 1, in 
>>>  open('sdjhfjshdfkjsh')
>>> FileNotFoundError: [Errno 2] No such file or directory: 'sdjhfjshdfkjsh'
>>>
>>> Now, does shutil pass on FileNotFoundError? I will let you experiment.
>>>
>>> There are error conditions that are hard to generate, but a bad file name
>>> is
>>> not one of them.
>>
>>
>> That's actually a perfectly valid file name, but one that doesn't
>> happen to have a corresponding file. However, the same technique will
>> work with the OP's description of "a filename which the FAT32 didn't
>> like" too.
>
>
> Yeah, that gives a different error and message.
 open('a~`!@#$%^&*()_-+={[}]|\<,>.?/')
>
> Traceback (most recent call last):
>   File "", line 1, in 
> open('a~`!@#$%^&*()_-+={[}]|\<,>.?/')
> OSError: [Errno 22] Invalid argument: 'a~`!@#$%^&*()_-+={[}]|\\<,>.?/'

That should be:

OSError: Profanity not permitted on respectable file systems

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread Steven D'Aprano
On Sat, 02 Mar 2013 09:53:47 -0500, Devin Jeanpierre wrote:

> On Sat, Mar 2, 2013 at 1:54 AM, Chris Angelico  wrote:
>> Yes, but reply-all sends a copy to the poster as well as the list. What
>> I want is reply-list, acknowledging the list headers... and Gmail
>> simply doesn't have that.
> 
> I've been replying to the poster and the list for ages. Is it bad
> netiquette?

I find it annoying, and yes I consider it rude. When we receive messages 
via a list, responses (unless personal and deliberately taken outside of 
the list) should remain on the list, rather than potentially bypassing 
any filters set up by the sender. E.g. the sender may have a filter that 
files mail to "Python-list" into a mail folder. If you send to the sender 
directly, you may break their filters.

I read this list via Usenet, not email. So when somebody replies to me, 
and the list, I get a copy in my inbox and a copy in my news client. 
That's a de facto filter, which they have just broken.

The mailman software used for the Python lists seem to be smart enough to 
only send the user one copy. But many mailing lists are not, and so when 
you reply to the author and CC the list, they may very well receive two 
copies.

In effect, the person replying is saying "MY reply is so important that I 
don't care how you process mail, I'm going to try to force you to read it 
MY way instead of in your preferred way." So, yes, I do consider it rude.

In the grand scheme of things though, it is a relatively minor rudeness. 
Pushing into line, or invading personal space, rather than breaking into 
my house and smearing excrement on the walls.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread Roy Smith
In article <513298fa$0$30001$c3e8da3$54964...@news.astraweb.com>,
 Steven D'Aprano  wrote:

> On Sat, 02 Mar 2013 09:53:47 -0500, Devin Jeanpierre wrote:
> 
> > On Sat, Mar 2, 2013 at 1:54 AM, Chris Angelico  wrote:
> >> Yes, but reply-all sends a copy to the poster as well as the list. What
> >> I want is reply-list, acknowledging the list headers... and Gmail
> >> simply doesn't have that.
> > 
> > I've been replying to the poster and the list for ages. Is it bad
> > netiquette?
> 
> I find it annoying, and yes I consider it rude.

I actually find it convenient and useful when people do that.  If 
somebody's replying to a thread I'm active on, I consider the responses 
to that thread to be higher priority than the rest of the firehose, so 
it's good for me that they've copied me directly.

I also read this list via usenet.  During the workday, I don't have 
convenient access to a newsreader, but I do get mail.  If I post a 
question to the group from home in the morning, when people cc me 
directly on replies, I get them quickly.  If they only post to the 
group, I have to either wait until I get home to catch up on netnews, or 
use one of several less convenient means of accessing the group from 
work.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Steven D'Aprano
On Sat, 02 Mar 2013 18:52:19 +0100, Kwpolska wrote:

> Also, you can do `except:` for a catch-all, but it is discouraged unless
> you have REALLY good reasons to do this.  And, most of the time, you
> don’t.


`except Exception` is to be much preferred over a bare except. It 
excludes KeyboardInterruptError (the user hits Ctrl-C) and SystemExit, 
which you normally either want to let through, or handle separately.


But yes, in general, only catch the minimum you *know* you need to catch 
and can deal with. Anything else is a bug in your code that needs to be 
fixed, and you can't fix it if you never see the exception.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Chris Angelico
On Sun, Mar 3, 2013 at 11:41 AM, Steven D'Aprano
 wrote:
> But yes, in general, only catch the minimum you *know* you need to catch
> and can deal with. Anything else is a bug in your code that needs to be
> fixed, and you can't fix it if you never see the exception.

With the exception (if you'll excuse the expression) of "framework"
systems, where there's a distinct separation between "inside" and
"outside". Often then, the "outside" will catch any exception thrown
by the "inside" and deal with it in some generic way (for instance, a
web server might log the details and return HTTP 500 to the client,
then go back and handle the next request). Effectively, this is doing
the job of the top-level exception handler: log the exception (to the
console) and terminate.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


RLock IO bound?

2013-03-02 Thread juancarlo . anez
Hello,

I have a set of processes that bring any number of cores to 100% use when 
unsynchronized (they take independent jobs from a queue).

As soon as I add an RLock to handle shared access to a file-system directory, 
the CPU utilization drops to 60%.

I'm not talking about overall speed here, but about processes that were CPU 
bound and suddenly become bound to something else with RLock.

Any explanations?

Cheers,

-- Juancarlo

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with exceptions

2013-03-02 Thread Steven D'Aprano
On Sat, 02 Mar 2013 11:35:13 -0800, bvdp wrote:


>> IOError and OSError should cover all copy problems, I think.
> 
> How do you know that? I can figure it out as well by running the
> program, but I'd like to make the determination of what to catch when
> I'm writing the code.


In my experience, I would say:

20% by reading the documentation, 20% by experience, and 60% by 
experimentation at the interactive interpreter.

Generally if you read the docs, you will get some idea of the exceptions 
you can expect to get. E.g. the docs for open claim:

"Raise IOError upon failure."

(call "help(open)" in the interactive interpreter).

Experience and experimentation come into it in the (unfortunately very 
common case) where the docs don't describe the exceptions you can expect.

For the specific case of IOError and OSError, another very useful skill 
is googling for the specific errno you can test for:

try:
something()
except IOError as e:
if e.errno == whatever:
do_this()
else:
raise


In Python 3.3, this becomes much nicer with individual exceptions for the 
most common errnos.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Pygame mouse cursor load/unload

2013-03-02 Thread Alex Gardner
I am in the process of making a pong game in python using the pygame library.  
My current problem is that when I move the mouse, it turns off as soon as the 
mouse stops moving.  The way I am doing this is by making the default cursor 
invisible and using .png files as replacements for the cursor.  Perhaps my code 
would best explain my problem.  I will take help in any way that I can.  Here 
are the links that contain my code:

Main class:  http://pastebin.com/HSQzX6h2
Main file (where the problem lies):  http://pastebin.com/67p97RsJ

If the links yield nothing, please let me know (agardner...@gmail.com)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread David Robinow
On Sat, Mar 2, 2013 at 7:27 PM, Steven D'Aprano
 wrote:
> On Sat, 02 Mar 2013 09:53:47 -0500, Devin Jeanpierre wrote:
>
>> On Sat, Mar 2, 2013 at 1:54 AM, Chris Angelico  wrote:
>>> Yes, but reply-all sends a copy to the poster as well as the list. What
>>> I want is reply-list, acknowledging the list headers... and Gmail
>>> simply doesn't have that.
>> I've been replying to the poster and the list for ages. Is it bad
>> netiquette?
>
> I find it annoying, and yes I consider it rude. When we receive messages
 ...
 Do you consider it rude that you choose to use a newsreader, thus
inconveniencing those of us who use the mailing list, as God intended.
(I honestly can't remember if there's any advantage to News, not
having used it this century)
 [Going out of my way to respond only to the list]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread Roy Smith
In article ,
 David Robinow  wrote:

> On Sat, Mar 2, 2013 at 7:27 PM, Steven D'Aprano
>  wrote:
> > On Sat, 02 Mar 2013 09:53:47 -0500, Devin Jeanpierre wrote:
> >
> >> On Sat, Mar 2, 2013 at 1:54 AM, Chris Angelico  wrote:
> >>> Yes, but reply-all sends a copy to the poster as well as the list. What
> >>> I want is reply-list, acknowledging the list headers... and Gmail
> >>> simply doesn't have that.
> >> I've been replying to the poster and the list for ages. Is it bad
> >> netiquette?
> >
> > I find it annoying, and yes I consider it rude. When we receive messages
>  ...
>  Do you consider it rude that you choose to use a newsreader, thus
> inconveniencing those of us who use the mailing list, as God intended.
> (I honestly can't remember if there's any advantage to News, not
> having used it this century)
>  [Going out of my way to respond only to the list]

There's a number of advantages to news vs. mail.  The biggest is that 
news spools generally keep a long history around, so it's easy to go 
back and review a long thread.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread David Robinow
On Sat, Mar 2, 2013 at 9:15 PM, Roy Smith  wrote:
> In article ,
>  David Robinow  wrote:
>
>> On Sat, Mar 2, 2013 at 7:27 PM, Steven D'Aprano
>>  wrote:
>> > On Sat, 02 Mar 2013 09:53:47 -0500, Devin Jeanpierre wrote:
>> >
>> >> On Sat, Mar 2, 2013 at 1:54 AM, Chris Angelico  wrote:
>> >>> Yes, but reply-all sends a copy to the poster as well as the list. What
>> >>> I want is reply-list, acknowledging the list headers... and Gmail
>> >>> simply doesn't have that.
>> >> I've been replying to the poster and the list for ages. Is it bad
>> >> netiquette?
>> >
>> > I find it annoying, and yes I consider it rude. When we receive messages
>>  ...
>>  Do you consider it rude that you choose to use a newsreader, thus
>> inconveniencing those of us who use the mailing list, as God intended.
>> (I honestly can't remember if there's any advantage to News, not
>> having used it this century)
>>  [Going out of my way to respond only to the list]
>
> There's a number of advantages to news vs. mail.  The biggest is that
> news spools generally keep a long history around, so it's easy to go
> back and review a long thread.
 That can't be the biggest since mail stays around forever unless
deliberately deleted.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread Chris Angelico
On Sun, Mar 3, 2013 at 2:01 PM, David Robinow  wrote:
> On Sat, Mar 2, 2013 at 9:15 PM, Roy Smith  wrote:
>> There's a number of advantages to news vs. mail.  The biggest is that
>> news spools generally keep a long history around, so it's easy to go
>> back and review a long thread.
>  That can't be the biggest since mail stays around forever unless
> deliberately deleted.

But your mail has only what you receive. You have to hunt down a
separate archive of what was posted before you joined the thread.
Advantage goes to news, but a slight one, and if that's the biggest,
it's not a great advertisement.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pygame mouse cursor load/unload

2013-03-02 Thread Ian Kelly
On Sat, Mar 2, 2013 at 6:56 PM, Alex Gardner  wrote:
> I am in the process of making a pong game in python using the pygame library. 
>  My current problem is that when I move the mouse, it turns off as soon as 
> the mouse stops moving.  The way I am doing this is by making the default 
> cursor invisible and using .png files as replacements for the cursor.  
> Perhaps my code would best explain my problem.  I will take help in any way 
> that I can.  Here are the links that contain my code:

Your mouse motion code draws the paddle in the new position, waits
1/10th of a second, and then draws over it again with the "invisible"
paddle.  Thus, approximately 1/10th of a second after you stop moving
the mouse, it disappears.

Mouse motion events are probably not the best way to do this.  You can
instead just capture the current position of the mouse on every frame
and use that instead.  I replaced your main loop with the following:

paddle_pos = (0, 0)
clock = pygame.time.Clock()

while True:
for event in pygame.event.get():
if event.type == QUIT:
sys.exit()

# Erase the paddle from the old mouse position.
screen.blit(bpaddle, paddle_pos)
# Redraw the net before the paddle so that the paddle can appear over it.
pygame.draw.line(screen, game.lineColor, game.net1, game.net2,
 game.netWidth)
# Get the new mouse position.
paddle_pos = pygame.mouse.get_pos()
# Draw the paddle at the new mouse position.
screen.blit(beeper, paddle_pos)
# Update the screen if it's double-buffered.
pygame.display.update()
# Finally, let the CPU idle until it's time for the next frame.
# 50 here means that it will sleep long enough to achieve 50 FPS.
clock.tick(50)

And I think you will find that this does what you want.

A couple more observations while I'm at it.  Generally there is no
need to be calling pygame.display.update() multiple times per frame.
Just draw everything that you need, and then call it once at the end
of the loop, as I have shown above.  Also, the shebang line only does
anything if it's the very first line in the file, so it would need to
appear before the module docstring to do anything useful.
-- 
http://mail.python.org/mailman/listinfo/python-list


Question about Tashaphyne package in python

2013-03-02 Thread yomnasalah91
I have a Python code that take an Arabic word and get the root and also remove 
diacritics, but i I have a problem with the output. For example  : when the 
input is "العربيه" the output is:"عرب" which is right answer but when the input 
is "كاتب" the output is:"ب", and when the input is "يخاف" the output is " خف".

This is my code:

# -*- coding=utf-8 -*-

import re
from arabic_const import *
import Tashaphyne
from Tashaphyne import *
import enum
from enum import Enum
search_type=Enum('unvoc_word','voc_word','root_word')

HARAKAT_pat = re.compile(ur"[" + u"".join([FATHATAN, DAMMATAN, KASRATAN, FATHA, 
DAMMA, KASRA, SUKUN, SHADDA]) + u"]")
HAMZAT_pat = re.compile(ur"[" + u"".join([WAW_HAMZA, YEH_HAMZA]) + u"]");
ALEFAT_pat = re.compile(ur"[" + u"".join([ALEF_MADDA, ALEF_HAMZA_ABOVE, 
ALEF_HAMZA_BELOW, HAMZA_ABOVE, HAMZA_BELOW]) + u"]");
LAMALEFAT_pat = re.compile(ur"[" + u"".join([LAM_ALEF, LAM_ALEF_HAMZA_ABOVE, 
LAM_ALEF_HAMZA_BELOW, LAM_ALEF_MADDA_ABOVE]) + u"]");
#--
def strip_tashkeel(w):
"strip vowel from a word and return a result word"
return HARAKAT_pat.sub('', w)

#strip tatweel from a word and return a result word
#--
def strip_tatweel(w):
"strip tatweel from a word and return a result word"
return re.sub(ur'[%s]' % TATWEEL,   '', w)


#--
def normalize_hamza(w):
"strip vowel from a word and return a result word"
w = ALEFAT_pat.sub(ALEF, w)
return HAMZAT_pat.sub(HAMZA, w)

#--
def normalize_lamalef(w):
"strip vowel from a word and return a result word"
return LAMALEFAT_pat.sub(u'%s%s' % (LAM, ALEF), w)

#--
def normalize_spellerrors(w):
"strip vowel from a word and return a result word"
w = re.sub(ur'[%s]' % TEH_MARBUTA,  HEH, w)
return re.sub(ur'[%s]' % ALEF_MAKSURA,  YEH, w)
def guess_stem(self,word):
"""
Detetect affixed letters based or phonetic root composition.
In Arabic language, there are some letters which can't be 
adjacent in a root.
This function return True, if the word is valid, else, return 
False

@param word: the word.
@type word: unicode.
@return: word with a '-' to indicate the stemming position.
@rtype: unicode
"""
# certain roots are forbiden in arabic
#exprimed in letters sequences
# but this sequence can be used for affixation
#then we can guess that this letters are affixed
#
#treat one prefixe letter
# we strip harkat and shadda
word=ar_strip_marks(word);
prefixes_letters=(TEH, MEEM,LAM,WAW,BEH, KAF,FEH,HAMZA,YEH,NOON)
prefixes_forbiden={
ALEF_HAMZA_ABOVE:(ALEF_HAMZA_ABOVE,ZAH,AIN,GHAIN),
BEH:(BEH,FEH,MEEM),
TEH:(THEH,DAL,THAL,ZAIN,SHEEN,SAD,DAD,TAH,ZAH),
FEH:(BEH,FEH,MEEM),
KAF:(JEEM,DAD,TAH,ZAH,QAF,KAF),
LAM:(REH,SHEEN,LAM,NOON),
MEEM:(BEH,FEH,MEEM),
NOON:(REH,LAM,NOON),
WAW:(WAW,YEH),

YEH:(THEH,JEEM,HAH,KHAH,THAL,ZAIN,SHEEN,SAD,DAD,TAH,ZAH,GHAIN,KAF,HEH,YEH),
}

word_guess=word;
if len(word)>=2:
c1=word[0];
c2=word[1];
#   if c1 in prefixes_letters and (c1 in 
prefixes_forbiden.keys() and c2 in prefixes_forbiden[c1]):
if  prefixes_forbiden.has_key(c1) and c2 in 
prefixes_forbiden[c1]:

word_guess=u"%s-%s"%(c1,word[1:])
if len(word_guess)>=4:
c1=word_guess[2];
c2=word_guess[3];
if c1 in prefixes_letters and ( c2 in 
prefixes_forbiden[c1]):

word_guess=u"%s-%s"%(c1,word_guess[2:])




# treat two suffixe letters
bisuffixes_letters=(KAF+MEEM,KAF+NOON,HEH+MEEM,HEH+NOON)

bisuffixes_forbiden={

HEH+MEEM:(ALEF_HAMZA_ABOVE,HAMZA,WAW_HAMZA,YEH_HAMZA,BEH,THEH,HAH, KHAH, SAD, 
DAD, TAH,ZAH,AIN,GHAIN,HEH,YEH),

KAF+MEEM:(ALEF_HAMZA_ABOVE,HAMZA,WAW_HAMZA,YEH_HAMZA,BEH,THEH,JEEM, 
KHAH,ZAIN,SEEN, SHEEN,DAD, TAH,ZAH,GHAIN, FEH, QAF,KAF, LAM, NOON, HEH,YEH),

HEH+NOON:(ALEF_HAMZA_ABOVE,HAMZA,WAW_HAMZA,YEH_HAMZA,BEH,THEH,JEEM,HAH, KHAH, 
SAD, DAD, TAH,ZAH,AIN,GHAIN,HEH,YEH),

KAF+NOON:(ALEF_HAMZA_ABOVE,HAMZA,WAW_HAMZA,YEH_HAMZA,BEH,THEH,JEEM,HAH, 
KHAH,THAL,SHEEN,DAD, TAH,ZAH,AIN, GHAIN, QAF,KAF, NOON, HEH,YEH),

 

Re: Is it correct this way to inherit from a list?

2013-03-02 Thread Chris Angelico
On Sun, Mar 3, 2013 at 1:30 PM, gialloporpora  wrote:
> Risposta al messaggio di Rick Johnson :
>
>
>> What are you trying to achieve exactly?
>
>
>
> I would like to implement a class (vector) to works with vectors, for
> example using scalar multiplication:
> a*v = [a*v1, a*vn]
> and a dual class for dual vector (the only method that I'll change is the
> __str__ method to print it as colun.

Have you looked at NumPy? I haven't used it myself, but I understand
it's good for this sort of thing.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread Steven D'Aprano
On Sat, 02 Mar 2013 19:42:50 -0500, Roy Smith wrote:

> In article <513298fa$0$30001$c3e8da3$54964...@news.astraweb.com>,
>  Steven D'Aprano  wrote:
> 
>> On Sat, 02 Mar 2013 09:53:47 -0500, Devin Jeanpierre wrote:
>> 
>> > On Sat, Mar 2, 2013 at 1:54 AM, Chris Angelico 
>> > wrote:
>> >> Yes, but reply-all sends a copy to the poster as well as the list.
>> >> What I want is reply-list, acknowledging the list headers... and
>> >> Gmail simply doesn't have that.
>> > 
>> > I've been replying to the poster and the list for ages. Is it bad
>> > netiquette?
>> 
>> I find it annoying, and yes I consider it rude.
> 
> I actually find it convenient and useful when people do that.  If
> somebody's replying to a thread I'm active on, I consider the responses
> to that thread to be higher priority than the rest of the firehose, so
> it's good for me that they've copied me directly.

Does your newsreader not have a "watch thread" command?


> I also read this list via usenet.  During the workday, I don't have
> convenient access to a newsreader, but I do get mail.  If I post a
> question to the group from home in the morning, when people cc me
> directly on replies, I get them quickly.  If they only post to the
> group, I have to either wait until I get home to catch up on netnews, 
> or use one of several less convenient means of accessing the group from
> work.

Or you could, I dunno, *work* while at work.





-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread Steven D'Aprano
On Sat, 02 Mar 2013 21:11:04 -0500, David Robinow wrote:

> On Sat, Mar 2, 2013 at 7:27 PM, Steven D'Aprano
>  wrote:
>> On Sat, 02 Mar 2013 09:53:47 -0500, Devin Jeanpierre wrote:
>>
>>> On Sat, Mar 2, 2013 at 1:54 AM, Chris Angelico 
>>> wrote:
 Yes, but reply-all sends a copy to the poster as well as the list.
 What I want is reply-list, acknowledging the list headers... and
 Gmail simply doesn't have that.
>>> I've been replying to the poster and the list for ages. Is it bad
>>> netiquette?
>>
>> I find it annoying, and yes I consider it rude. When we receive
>> messages
>  ...
>  Do you consider it rude that you choose to use a newsreader, thus
> inconveniencing those of us who use the mailing list, as God intended.

How the flying fuck does my choice of where and how *I* read this forum 
inconvenience YOU?

Talk about an overactive sense of entitlement. The world does not revolve 
around you and I do not arrange my day to suit your preferences.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread David Robinow
On Sat, Mar 2, 2013 at 10:06 PM, Chris Angelico  wrote:
> On Sun, Mar 3, 2013 at 2:01 PM, David Robinow  wrote:
>> On Sat, Mar 2, 2013 at 9:15 PM, Roy Smith  wrote:
>>> There's a number of advantages to news vs. mail.  The biggest is that
>>> news spools generally keep a long history around, so it's easy to go
>>> back and review a long thread.
>>  That can't be the biggest since mail stays around forever unless
>> deliberately deleted.
>
> But your mail has only what you receive. You have to hunt down a
> separate archive of what was posted before you joined the thread.
> Advantage goes to news, but a slight one, and if that's the biggest,
> it's not a great advertisement.
 I have no idea what you're trying to say here. As far as I know, when
I subscribe to a list I get all the mail. I don't "join" threads. I
don't even know what that means.
[This has drifted way off topic so I won't be responding again, but
I'll enjoy reading what anyone cares to write.]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread Chris Angelico
On Sun, Mar 3, 2013 at 2:18 PM, David Robinow  wrote:
> On Sat, Mar 2, 2013 at 10:06 PM, Chris Angelico  wrote:
>> But your mail has only what you receive. You have to hunt down a
>> separate archive of what was posted before you joined the thread.
>> Advantage goes to news, but a slight one, and if that's the biggest,
>> it's not a great advertisement.
>  I have no idea what you're trying to say here. As far as I know, when
> I subscribe to a list I get all the mail. I don't "join" threads. I
> don't even know what that means.
> [This has drifted way off topic so I won't be responding again, but
> I'll enjoy reading what anyone cares to write.]

Err, joined the list is what I meant. At any given time, there are a
certain number of active threads; anyone who joins the list will get
the posts since joining but not the ones prior, for which they'll have
to dig around elsewhere. Since netiquette recommends that posts quote
enough of the prior posts to provide context, this shouldn't be a
major problem, but there is a bit of advantage to news here.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pygame mouse cursor load/unload

2013-03-02 Thread Alex Gardner
On Saturday, March 2, 2013 9:08:18 PM UTC-6, Ian wrote:
> On Sat, Mar 2, 2013 at 6:56 PM, Alex Gardner  wrote:
> 
> > I am in the process of making a pong game in python using the pygame 
> > library.  My current problem is that when I move the mouse, it turns off as 
> > soon as the mouse stops moving.  The way I am doing this is by making the 
> > default cursor invisible and using .png files as replacements for the 
> > cursor.  Perhaps my code would best explain my problem.  I will take help 
> > in any way that I can.  Here are the links that contain my code:
> 
> 
> 
> Your mouse motion code draws the paddle in the new position, waits
> 
> 1/10th of a second, and then draws over it again with the "invisible"
> 
> paddle.  Thus, approximately 1/10th of a second after you stop moving
> 
> the mouse, it disappears.
> 
> 
> 
> Mouse motion events are probably not the best way to do this.  You can
> 
> instead just capture the current position of the mouse on every frame
> 
> and use that instead.  I replaced your main loop with the following:
> 
> 
> 
> paddle_pos = (0, 0)
> 
> clock = pygame.time.Clock()
> 
> 
> 
> while True:
> 
> for event in pygame.event.get():
> 
> if event.type == QUIT:
> 
> sys.exit()
> 
> 
> 
> # Erase the paddle from the old mouse position.
> 
> screen.blit(bpaddle, paddle_pos)
> 
> # Redraw the net before the paddle so that the paddle can appear over it.
> 
> pygame.draw.line(screen, game.lineColor, game.net1, game.net2,
> 
>  game.netWidth)
> 
> # Get the new mouse position.
> 
> paddle_pos = pygame.mouse.get_pos()
> 
> # Draw the paddle at the new mouse position.
> 
> screen.blit(beeper, paddle_pos)
> 
> # Update the screen if it's double-buffered.
> 
> pygame.display.update()
> 
> # Finally, let the CPU idle until it's time for the next frame.
> 
> # 50 here means that it will sleep long enough to achieve 50 FPS.
> 
> clock.tick(50)
> 
> 
> 
> And I think you will find that this does what you want.
> 
> 
> 
> A couple more observations while I'm at it.  Generally there is no
> 
> need to be calling pygame.display.update() multiple times per frame.
> 
> Just draw everything that you need, and then call it once at the end
> 
> of the loop, as I have shown above.  Also, the shebang line only does
> 
> anything if it's the very first line in the file, so it would need to
> 
> appear before the module docstring to do anything useful.

Thank you very much, Ian.  I understand the code and have learned from it.  If 
I were more knowledgeable in python I wouldn't have had to ask; I am learning 
as I go with this project.  Again, thank you :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread Devin Jeanpierre
On Sat, Mar 2, 2013 at 10:21 PM, Steven D'Aprano
 wrote:
> How the flying fuck does my choice of where and how *I* read this forum
> inconvenience YOU?
>
> Talk about an overactive sense of entitlement. The world does not revolve
> around you and I do not arrange my day to suit your preferences.

I don't agree with what he said, but I think what he was getting at is
that it's inconvenient to be polite to you according to the standards
you have set.

-- Devin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to install development package on linux?

2013-03-02 Thread Sarbjit singh
On Sunday, March 3, 2013 1:22:50 AM UTC+5:30, Kwpolska wrote:
> On Sat, Mar 2, 2013 at 7:00 PM, Sarbjit singh  wrote:
> 
> > On Saturday, March 2, 2013 2:15:08 PM UTC+5:30, Kwpolska wrote:
> 
> >> On Sat, Mar 2, 2013 at 7:24 AM, Sarbjit singh  
> >> wrote:
> 
> >>
> 
> >> > Sorry for this basic question but I am having problem compiling mod_wsgi 
> >> > on Linux. As per mod_wsgi package site, user must have python 
> >> > development package installed on system.
> 
> >>
> 
> >> >
> 
> >>
> 
> >> > I had installed Python2.7 on my Linux system from source code, using the 
> >> > following configuration few months back :-
> 
> >>
> 
> >> >
> 
> >>
> 
> >> > ./configure –prefix= --enable-shared
> 
> >>
> 
> >> > Make –i install
> 
> >>
> 
> >> >
> 
> >>
> 
> >> > But I am not able to find how to install development package from source 
> >> > code.
> 
> >>
> 
> >> >
> 
> >>
> 
> >> > Can some one please conform if I can install the development package 
> >> > from the same source code (Downloaded from Python Website for Unix) and 
> >> > please share the configuration switch for the same.
> 
> >>
> 
> >> >
> 
> >>
> 
> >> > Thanks,
> 
> >>
> 
> >> > Sarbjit
> 
> >>
> 
> >> > --
> 
> >>
> 
> >> > http://mail.python.org/mailman/listinfo/python-list
> 
> >>
> 
> >>
> 
> >>
> 
> >> Why do you use source tarballs?  Your distro should provide nice
> 
> >>
> 
> >> binary packages for Python and mod_wsgi.  And in case it doesn’t, your
> 
> >>
> 
> >> distro sucks and you should find a better one.
> 
> >>
> 
> >>
> 
> >>
> 
> >> The development things are usually installed by default by most
> 
> >>
> 
> >> things.  Distributions offer them in -dev or -devel packages.
> 
> >>
> 
> >>
> 
> >>
> 
> >> --
> 
> >>
> 
> >> Kwpolska  | GPG KEY: 5EAAEA16
> 
> >>
> 
> >> stop html mail| always bottom-post
> 
> >>
> 
> >> http://asciiribbon.org| http://caliburn.nl/topposting.html
> 
> >
> 
> > I am using Red Hat 5, could you please give some pointers on how to install 
> > these packages?
> 
> > --
> 
> > http://mail.python.org/mailman/listinfo/python-list
> 
> 
> 
> Impossible, unless you:
> 
> (a) build such packages yourself (Fedora .spec files may help you); or
> 
> (b) upgrade to RHEL 6, which offers packages for python 2.6 and mod_wsgi; or
> 
> (c) look for such packages on the Internet (you probably won’t find any).
> 
> 
> 
> So, get back to compiling from source.  Have you actually tried
> 
> building those packages before asking?  Because, according to the Arch
> 
> Linux PKGBUILDs for python2 and mod_wsgi2, it doesn’t have any
> 
> specific switches to enable anything “devel-related” (also, Arch Linux
> 
> doesn’t bother with the dumb -dev(el) packages, which make no sense in
> 
> real life).
> 
> 
> 
> -- 
> 
> Kwpolska  | GPG KEY: 5EAAEA16
> 
> stop html mail| always bottom-post
> 
> http://asciiribbon.org| http://caliburn.nl/topposting.html

Its not possible for me to switch to Red Hat6 at the moment. 

Yes, I did tried compiling these from the source code and got some errors. I am 
using Xaamp for linux and following the below link for configuring 
python/mod_wsgi :-

 http://www.apachefriends.org/f/viewtopic.php?f=17&t=42975

When I initially tried to compile mod_wsgi, I was getting errors which got 
resolved by using development package fro Xammp for linux. (Solution found on 
google) 

Now I am getting the following compiling errors:-

#
mod_wsgi.c:14967: error: expected expression before ')' token
mod_wsgi.c:14974: error: expected ';' before 'do'
mod_wsgi.c:14979: error: expected ';' before '}' token
mod_wsgi.c:14984: error: too many arguments to function 'wsgi_log_python_error'
mod_wsgi.c:14989: error: expected expression before 'module'
mod_wsgi.c: In function 'wsgi_allow_access':
mod_wsgi.c:15003: error: 'PyObject' undeclared (first use in this function)
mod_wsgi.c:15003: error: 'modules' undeclared (first use in this function)
mod_wsgi.c:15004: error: expected expression before 'module'
mod_wsgi.c:15051: error: 'Py_BEGIN_ALLOW_THREADS' undeclared (first use in this 
function)
mod_wsgi.c:15052: error: expected ';' before 'apr_thread_mutex_lock'
mod_wsgi.c:15053: error: 'Py_END_ALLOW_THREADS' undeclared (first use in this 
function)
mod_wsgi.c:15056: error: expected ';' before 'modules'
mod_wsgi.c:15057: error: expected identifier or '(' before '=' token
mod_wsgi.c:15059: error: expected expression before 'module'
mod_wsgi.c:15061: error: expected expression before 'module'
mod_wsgi.c:15070: error: expected expression before 'module'
mod_wsgi.c:15071: error: expected expression before 'module'
mod_wsgi.c:15082: error: expected expression before 'module'
mod_wsgi.c:15083: error: expected identifier or '(' before '=' token
mod_wsgi.c:15089: error: expected expression before 'module'
mod_wsgi.c:15090: error: expected identifier or '(' before '=' token
mod_wsgi.c:15105:

Re: How to install development package on linux?

2013-03-02 Thread Benjamin Kaplan
On Sat, Mar 2, 2013 at 10:14 PM, Sarbjit singh  wrote:
>
> I searched on google and found these errors could be due to missing python 
> header files which would be available in development package.
>
> So I am struggling to make it work.


A "development package" is meaningless when you aren't installing it
from a package. Debian's binary packages don't include the header
files, so they put them in a different package. Since you compiled
from source, you already have the header files. Did you include the
directory you installed Python into on your library and includes
paths?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: RLock IO bound?

2013-03-02 Thread Cameron Simpson
On 02Mar2013 17:35, juancarlo.a...@gmail.com  wrote:
| I have a set of processes that bring any number of cores to 100%
| use when unsynchronized (they take independent jobs from a queue).
| 
| As soon as I add an RLock to handle shared access to a file-system
| directory, the CPU utilization drops to 60%.
| 
| I'm not talking about overall speed here, but about processes
| that were CPU bound and suddenly become bound to something else
| with RLock.

Shrug. If your threads do some I/O and now block where they would
have overlapped then suddenly your threads can't do compute all the
time. Ergo, less CPU utilisation.

Without more detail nobody can say where your particular bottleneck
lies, but I would be very very surprised if the RLock was the
bottleneck; what you're doing _inside_ the RLock is the bottleneck.
-- 
Cameron Simpson 

My computer always does exactly what I tell it to do but sometimes I have
trouble finding out what it was that I told it to do.
- Dick Wexelblat 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to install development package on linux?

2013-03-02 Thread Sarbjit singh
On Sunday, March 3, 2013 11:53:50 AM UTC+5:30, Benjamin Kaplan wrote:
> On Sat, Mar 2, 2013 at 10:14 PM, Sarbjit singh  wrote:
> 
> >
> 
> > I searched on google and found these errors could be due to missing python 
> > header files which would be available in development package.
> 
> >
> 
> > So I am struggling to make it work.
> 
> 
> 
> 
> 
> A "development package" is meaningless when you aren't installing it
> 
> from a package. Debian's binary packages don't include the header
> 
> files, so they put them in a different package. Since you compiled
> 
> from source, you already have the header files. Did you include the
> 
> directory you installed Python into on your library and includes
> 
> paths?

Yes, I configured the makefile for mod_wsgi as without any error :

 ./configure --prefix=/opt/lampp/ --with-apxs=/opt/lampp/bin/apxs 
--with-python=/opt/lampp/python/bin/python2.7 
--with-mutex-dir=/opt/lampp/var/run/wsgi

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to install development package on linux?

2013-03-02 Thread Sarbjit singh
On Sunday, March 3, 2013 12:09:46 PM UTC+5:30, Sarbjit singh wrote:
> On Sunday, March 3, 2013 11:53:50 AM UTC+5:30, Benjamin Kaplan wrote:
> 
> > On Sat, Mar 2, 2013 at 10:14 PM, Sarbjit singh  
> > wrote:
> 
> > 
> 
> > >
> 
> > 
> 
> > > I searched on google and found these errors could be due to missing 
> > > python header files which would be available in development package.
> 
> > 
> 
> > >
> 
> > 
> 
> > > So I am struggling to make it work.
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > A "development package" is meaningless when you aren't installing it
> 
> > 
> 
> > from a package. Debian's binary packages don't include the header
> 
> > 
> 
> > files, so they put them in a different package. Since you compiled
> 
> > 
> 
> > from source, you already have the header files. Did you include the
> 
> > 
> 
> > directory you installed Python into on your library and includes
> 
> > 
> 
> > paths?
> 
> 
> 
> Yes, I configured the makefile for mod_wsgi as without any error :
> 
> 
> 
>  ./configure --prefix=/opt/lampp/ --with-apxs=/opt/lampp/bin/apxs 
> --with-python=/opt/lampp/python/bin/python2.7 
> --with-mutex-dir=/opt/lampp/var/run/wsgi

Also my LD_LIBRARY_PATH does have path as :

/opt/lammp/python/lib

Just one more point, while initially I was trying to compiling the mod_wsgi, I 
was getting error for "libpython2.7.1.0.so Shared library error".

I resolved it by creating a soft link to this file in my /usr/lib and 
/usr/lib64. At that point also my LD_LIBRARY_PATH was having path for python 
lib but was resolved with soft link only.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: i need help

2013-03-02 Thread Michael Torrie
On 02/21/2013 03:18 AM, leonardo wrote:
> thanks, problem solved

Apparently not.  The shift key on your keyboard still seems to be
non-functional. ;)
-- 
http://mail.python.org/mailman/listinfo/python-list