Re: select.poll and ppoll

2015-10-22 Thread Paul Rubin
Steven D'Aprano  writes:
> I have select.poll, but I'm looking for something like ppoll instead. From 
> the Linux man page:

I don't understand your post: do you have a question?

Also I thought the current preferred practice was to use epoll.
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: unicode 2

2015-10-22 Thread garabik-news-2005-05
unicode is a simple python command line utility that displays
properties for a given unicode character, or searches
unicode database for a given name.

It was written with Linux in mind, but should work almost everywhere
(including MS Windows and MacOSX), UTF-8 console is recommended.

˙pɹɐpuɐʇs əpoɔı̣uՈ əɥʇ ɟo əsn pəɔuɐʌpɐ
puɐ səldı̣ɔuı̣ɹd əɥʇ ɓuı̣ʇɐɹʇsuoɯəp looʇ ɔı̣ʇɔɐpı̣p ʇuəlləɔxə uɐ sı̣ ʇI
˙sʇuı̣odəpoɔ ʇuəɹəɟɟı̣p ʎləʇəldɯoɔ ɓuı̣sn əlı̣ɥʍ 'sɥdʎlɓ ɟo ɯɐəɹʇs ɹɐlı̣ɯı̣s
ʎllɐnsı̣ʌ  oʇuı̣ ʇxəʇ əɥʇ ʇɹəʌuoɔ oʇ pɹɐpuɐʇs əpoɔı̣uՈ əɥʇ ɟo ɹəʍod llnɟ
əɥʇ sʇı̣oldxə ʇɐɥʇ 'ʎʇı̣lı̣ʇn ,əpoɔɐɹɐd, oslɐ suı̣ɐʇuoɔ əɓɐʞɔɐd əɥ⊥

Changes since previous versions:

 * substantially rewritten formatting
 * full python3 support
 * user defined output format
 * added --brief for a brief format
 * dropped python2.5 support

URL:
http://kassiopeia.juls.savba.sk/~garabik/software/unicode.html

License: GPL v3

-- 
 ---
| Radovan Garabík http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__garabik @ kassiopeia.juls.savba.sk |
 ---
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!
-- 
https://mail.python.org/mailman/listinfo/python-list


Pause and Resuming of a file upload process to AWS S3

2015-10-22 Thread ashwath
 Hi
 
I wanted to know whether it is possible in python to pause and resume the file 
upload process to AWS S3, I tried a lot but I did not get any solution so I 
request you to get me a solution for this.
If it is possible to do so can you please let me know how to do.
 
My alternate email id = ashwathbhgo...@gmail.com 
 
Thanks & Regards
Ashwath
India
-- 
https://mail.python.org/mailman/listinfo/python-list


Pandas' loading a CSV file problem

2015-10-22 Thread Ek Esawi
Hi All---

I am new to Pandas. I am trying to load a csv file into pandas using



 import pandas as pd

f = pd.read_csv(OSATemp.csv')



Even though I was able to read and manipulate the file in Python343, in
Pandas the file could not be loaded. When I run the above statement, I get
a series of massages such as



Traceback (most recent call last):

File "C:\Users\EK Esawi\Anaconda3\Scripts\file1.py", line 3, in 

f = pd.read_csv('c:/Users/EK Esawi/My Documents/Temp/GOSATemp.csv')

  File "C:\Users\EK
Esawi\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 474, in
parser_f



Any help/suggestion is greatly appreciated—EKE



Here is a sample of my csv file:



120891

120891

120873

120890

120890

120754

120891

120890

120890

O

Geyser

RT

Time

Interval

Duration

Preplay

Height

Prediction

42

Old Faithful

8:16

3:00

43

Old Faithful

9:55

1:39

4:15

9:41

130+

9:49

44

Old Faithful

11:33

1:38

3:59

11:20

130

11:28

45

Old Faithful

13:00

1:27

4:00

13:00

140

13:06

46

Old Faithful

14:42

1:42

3:44

14:29

150

14:33

47

Old Faithful

16:08

1:26

>4:00

16:02

140+

16:15

56

Castle

E

9:36

9:40ie

75

Old Faithful

7:23

>3:00

76

Old Faithful

9:05

1:42

4:13

8:52

150

8:05

77

Old Faithful

10:37

1:32

4:08

10:32

130

10:38

78

Old Faithful

12:02

1:25

3:00

11:59

130

12:10

79

Old Faithful

13:38

1:36

>3:30

13:27

13:00

80

Old Faithful

15:08

1:30

4:05

15:02

15:01

81

Old Faithful

16:42

1:34

3:54

16:32

150

16:41
-- 
https://mail.python.org/mailman/listinfo/python-list


UNABLE TO GET IDLE TO RUN

2015-10-22 Thread Terry Alexander via Python-list
Hello...
I have tried installing both Python 2.7 and 3.5, and in both cases I cannot get 
IDLE to work. I received the following message both times:
IDLE’s subprocess didn’t make connection.  Either IDLE can’t start a subprocess 
or personalfirewall software is blocking the connection.
I am running Norton, and disabled it, but still IDLE will not run. Any 
suggestions?
Thank you...
Terry Alexander709-745-2953


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


Re: variable scope of class objects

2015-10-22 Thread Erik

On 20/10/15 22:33, jon...@mail.python.org wrote:

In your comment you mentioned that convention is to declare variables
(and constants?)  in the construction (__ini__).


I would suggest that 'constants' are not 'declared' in the __init__ 
method body, but either as class variables or (see later) at module scope.



I am concerned that the sheer number of varialbe / constants would
make it difficult to read.


Remember that "instance variables" in Python are just name bindings to 
another object which are placed in the object's dictionary.


Python is not like some other languages where you declare your object's 
member variables statically and they all magically exist when you create 
the object (whether you initialise them or not): none of the bindings 
exist until an assignment is executed.


Therefore, you _must_ have a set of assignments which are executed to 
create the object with the bindings (or "instance variables") that you 
require. This is _usually_ done in __init__ with a set of assignments to 
'self' - either using default values or values passed in to __init__.




You may be getting to the point where the best way to structure this is 
to write your own module (rather than just a class) which you then 
import from your main script. For example, you might do something like this:


mymodule.py:

CONSTANT_X = 0x99
CONSTANT_Y = 0xF00
CONSTANT_Z = "Spam"

class MyObject(object):
def __init__(self, foo, bar):
# 'foo' can be anything. 'bar' must be one of
# a specific set of values:
if bar not in (CONSTANT_X, CONSTANT_Y):
raise ValueError("Parameter 'bar'")

self.foo = foo
self.bar = bar

Then, in your main script you might do something like:

import mymodule

obj = mymodule.MyObject(100, mymodule.CONSTANT_X)

... then start calling methods on 'obj'.

So you just define your address and variable constants at module level 
and import them along with any class and function definitions.


E.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Defamation

2015-10-22 Thread John O'Hagan
On Wed, 21 Oct 2015 00:09:18 +1100
Steven D'Aprano  wrote:

 
> I don't believe that the Python mailing list archives are hosted in a
> country under the jurisdiction of European Law. If I'm right, then
> removing posts sets a dangerous precedent of obeying laws in foreign
> countries that don't apply.

For better or worse, that's not how defamation law works. Generally,
the defaming is regarded as happening where the material is read, i.e.
at the point of download. The location of upload, hosting etc is
irrelevant, although the uploader and the host can both be liable
along with the author. Of course, the point is moot if none of those
people has assets in that jurisdiction. 

For example:

https://en.wikipedia.org/wiki/Dow_Jones_%26_Co_Inc_v_Gutnick

On the specific point, I think it's possible to agree with both
Steven and Laura. It's a bad idea to obey laws that don't apply to
you if you'd rather not. It's also a good idea if possible to remove
defamatory material, not because it might be illegal, but because it's
defamatory. 

Regards

John


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


Re: Pandas' loading a CSV file problem

2015-10-22 Thread Chris Angelico
On Thu, Oct 22, 2015 at 8:57 AM, Ek Esawi  wrote:
>
> Traceback (most recent call last):
>
> File "C:\Users\EK Esawi\Anaconda3\Scripts\file1.py", line 3, in 
>
> f = pd.read_csv('c:/Users/EK Esawi/My Documents/Temp/GOSATemp.csv')
>
>   File "C:\Users\EK Esawi\Anaconda3\lib\site-packages\pandas\io\parsers.py", 
> line 474, in parser_f
>
>

You've missed off the critical line at the end, where it says what the
actual error is. Can you copy and paste the whole error text, please?
Also, I suspect something might have become mangled in transmission;
if you can copy and paste your code as well, and make sure you post as
plain text (not "rich text" or "HTML" or "formatted text" or anything
like that), that would help.

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


Re: Defamation

2015-10-22 Thread Chris Angelico
On Thu, Oct 22, 2015 at 11:45 AM, John O'Hagan  wrote:
> On Wed, 21 Oct 2015 00:09:18 +1100
> Steven D'Aprano  wrote:
>
>
>> I don't believe that the Python mailing list archives are hosted in a
>> country under the jurisdiction of European Law. If I'm right, then
>> removing posts sets a dangerous precedent of obeying laws in foreign
>> countries that don't apply.
>
> For better or worse, that's not how defamation law works. Generally,
> the defaming is regarded as happening where the material is read, i.e.
> at the point of download. The location of upload, hosting etc is
> irrelevant, although the uploader and the host can both be liable
> along with the author. Of course, the point is moot if none of those
> people has assets in that jurisdiction.

So... someone in Europe who rents a server in the US has to worry
about defamation law in literally every country on this planet, or
else IP-ban people from accessing the server, just in case s/he's
liable? Is that really how this works? Ouch.

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


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Peter Brittain
On Wednesday, October 21, 2015 at 11:26:40 PM UTC+1, eryksun wrote:
> 
> Also check out the curses module that's available on Christoph Gohlke's site:
> 
> http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses

Neat.  I wasn't aware of this library of wheel installations.  I'll have a look 
at how that works out and see if I can rationalize my mapping code.  

First impression is that this might be tricky, though, as I've had issues with 
older Linux distributions using ncurses 5 and so handling 256 colour modes has 
been difficult due to limits on colour pairs.  This meant I had to fall back to 
looking up and using codes in the terminfo database using tigetstr.  According 
to the PDcurses docs, these APIs are all just stubs that return an error and so 
I'll probably need a curses and PDcurses mapping layer from the looks of things 
- which is not much better than a curses and win32 mapping layer.

I'm also still not convinced that curses package is the right API to expose for 
Python.  While ncurses does a great job of abstracting away the issues of 
terminal inter-operation, the Python curses package is just a thin wrapper of 
that C library and, as can be seen above, not truly cross-platform due to the 
restrictions of PDcurses.

Shouldn't we have a higher level simplification?  Something that hides away all 
the complexity of handling all these different platforms and so exposes a 
simple API?  One that humans can use without worrying about these issues?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: select.poll and ppoll

2015-10-22 Thread Laura Creighton
In a message of Thu, 22 Oct 2015 16:38:52 +1100, "Steven D'Aprano" writes:
>Using Python 2.6, don't hate me.

>Technically, *I* don't want this, it's one of my work-colleagues. He says:
>
>"My high-level goal is to run a callback function whenever the alsa mixer 
>level changes.  The C alsa API provides snd_mixer_elem_set_callback, but the 
>Python API (import alsaaudio) seems to need me to get poll(2) descriptors"

>-- 
>Steve
>
>-- 
>https://mail.python.org/mailman/listinfo/python-list

Do you need alsa-mixer or would pulse-audio work for you?
Would this: https://github.com/mk-fg/pulseaudio-mixer-cli
do the job?

Laura (alsa-mixer hater)

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


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Laura Creighton
In a message of Thu, 22 Oct 2015 02:02:28 -0700, Peter Brittain writes:
>On Wednesday, October 21, 2015 at 11:26:40 PM UTC+1, eryksun wrote:
>> 
>> Also check out the curses module that's available on Christoph Gohlke's site:
>> 
>> http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses
>
>Neat.  I wasn't aware of this library of wheel installations.  I'll have a 
>look at how that works out and see if I can rationalize my mapping code.  
>
>First impression is that this might be tricky, though, as I've had issues with 
>older Linux distributions using ncurses 5 and so handling 256 colour modes has 
>been difficult due to limits on colour pairs.  This meant I had to fall back 
>to looking up and using codes in the terminfo database using tigetstr.  
>According to the PDcurses docs, these APIs are all just stubs that return an 
>error and so I'll probably need a curses and PDcurses mapping layer from the 
>looks of things - which is not much better than a curses and win32 mapping 
>layer.
>
>I'm also still not convinced that curses package is the right API to expose 
>for Python.  While ncurses does a great job of abstracting away the issues of 
>terminal inter-operation, the Python curses package is just a thin wrapper of 
>that C library and, as can be seen above, not truly cross-platform due to the 
>restrictions of PDcurses.
>
>Shouldn't we have a higher level simplification?  Something that hides away 
>all the complexity of handling all these different platforms and so exposes a 
>simple API?  One that humans can use without worrying about these issues?
>-- 
>https://mail.python.org/mailman/listinfo/python-list

Fredrik Lundh's console implementation
http://effbot.org/zone/console-handbook.htm
might be of interest in that case, but I think it is 'old versions
of windows only'.  But it's a different take on the abstraction 
problem.  I haven't used it for something like 15 years now, though,
so can barely remember it ...

Laura
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: variable scope of class objects

2015-10-22 Thread Luca Menegotto

Maybe I've been too cryptic. I apologize.

Il 22/10/2015 01:35, JonRob ha scritto:

@Dennis,


Thanks for your example.  My structure is very similar.


And that's ok. But you can also 'attach' the constants to a class, if it 
makes sense. For example, the same code of Dennis can be written as:


class SensorA():
GYROXREG = 0x0010
GYROYREG = 0x0011
GYROZREG = 0x0001
_registers = [GYROXREG, GYROYREG, GYROZREG]

And then you can invoke those constants as:

SensorA.GYROXREG

to emphasize that they are significant to this class, and to this class 
only.



 Luca wrote...

Please, note that declaring a variable in the constructor is only a
convention: in Python you can add a variable to an object of a class
wherever you want in your code (even if it is very dangerous and
discouraged).


This is the cryptic part.
I mean: you can do, and it's perfectly legal:

class A():
def __init__(self):
self.a = 10

if __name__ == '__main__':
o = A()
print(o.a)
# this is a new member, added on the fly
o.b = 20
print(o.b)

but, for God's sake, use it only if you have a gun at your head!

--
Ciao!
Luca

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


Re: Defamation

2015-10-22 Thread John O'Hagan
On Thu, 22 Oct 2015 19:05:04 +1100
Chris Angelico  wrote:

> On Thu, Oct 22, 2015 at 11:45 AM, John O'Hagan 
[...]

> >
> > For better or worse, that's not how defamation law works. Generally,
> > the defaming is regarded as happening where the material is read,
> > i.e. at the point of download. The location of upload, hosting etc
> > is irrelevant, although the uploader and the host can both be liable
> > along with the author. Of course, the point is moot if none of those
> > people has assets in that jurisdiction.
> 
> So... someone in Europe who rents a server in the US has to worry
> about defamation law in literally every country on this planet, or
> else IP-ban people from accessing the server, just in case s/he's
> liable? Is that really how this works? Ouch.
> 

It does seem harsh, and that Gutnick case I linked to was greeted with
great alarm around the world back in 2002 for the same reasons as
you've raised. In fact, some predicted a new age of "libel tourism",
where people would travel to countries with especially harsh laws in
order to sue, and the subsequent "death of the internet".

But it hasn't turned out as badly as all that. The only noticeable
change has been some cautious online publishers requiring readers
to register. As I mentioned, it's only an issue if the defamed has
reputation and the defamer has assets in the same jurisdiction. 

Once you think it through, it's pretty logical. If I write a defamatory
letter about you and put it in a mailbox (upload it to a server), no
defamation has happened yet. If someone reads it later (downloads it) in
a country where no-one has heard of you, still no defamation. If
someone reads it in a country where everyone knows you,
but where I have no property, then technically there is defamation
but you have no way to make me pay. It's only a civil claim so it's not
like I'll have a criminal record or Interpol on my tail or anything.

The other reason it makes sense is the alternative. If server location
determined the jurisdiction, you'd have Cayman-style "libel-havens"
with super-lax laws, stacked with servers people could use to
defame anyone anywhere with impunity. I love free speech but not that
much.

Regards

John 

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


Re: Defamation

2015-10-22 Thread Oscar Benjamin
On 22 October 2015 at 09:05, Chris Angelico  wrote:
> On Thu, Oct 22, 2015 at 11:45 AM, John O'Hagan  wrote:
>> On Wed, 21 Oct 2015 00:09:18 +1100
>> Steven D'Aprano  wrote:
>>
>>
>>> I don't believe that the Python mailing list archives are hosted in a
>>> country under the jurisdiction of European Law. If I'm right, then
>>> removing posts sets a dangerous precedent of obeying laws in foreign
>>> countries that don't apply.
>>
>> For better or worse, that's not how defamation law works. Generally,
>> the defaming is regarded as happening where the material is read, i.e.
>> at the point of download. The location of upload, hosting etc is
>> irrelevant, although the uploader and the host can both be liable
>> along with the author. Of course, the point is moot if none of those
>> people has assets in that jurisdiction.
>
> So... someone in Europe who rents a server in the US has to worry
> about defamation law in literally every country on this planet, or
> else IP-ban people from accessing the server, just in case s/he's
> liable? Is that really how this works? Ouch.

Yeah the idea of national laws being subject to some kind of
internationally agreed jurisdiction is nice but has never been
implemented. Since you mention the US it's worth noting that some US
federal laws effectively have global jurisdiction. This means that
someone anywhere in the world can be deemed to have committed a
criminal offence under certain US laws even if their actions are
entirely legal under local law.

I have a feeling that something may have changed recently but
certainly until a few years ago we used to have lots of cases of
"libel tourism" in the UK. This is where someone decides to bring a
libel case which has nothing to do with the UK before the UK courts
because libel law here is steeped in favour of the litigant. UK law
requires the case to have a connection to the UK but the courts were
apparently prepared to accept very tenuous connections (presumably
because the whole business could function as an "export" bringing
loads of money to all the lawyers involved). AFAIK these cases usually
concerned foreign newspaper websites rather than something like the
archive here though.

Leaving aside the issue of "defamation" the posts that have been
removed here are IMO "spam" and it's entirely reasonable to remove
them regardless of any legal issues.

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Peter Brittain
On Thursday, October 22, 2015 at 10:24:11 AM UTC+1, Laura Creighton wrote:
> Fredrik Lundh's console implementation
> http://effbot.org/zone/console-handbook.htm
> might be of interest in that case, but I think it is 'old versions
> of windows only'.  But it's a different take on the abstraction 
> problem.  I haven't used it for something like 15 years now, though,
> so can barely remember it ...

Thanks, but I think this is already covered in my original post: I couldn't use 
it directly due to the pip installation restriction.  I've now created a 
working Windows implementation, so I don't need another mapping for win32.

More generally, as these posts begin to show, there was no _simple_ way for me 
to get a cross-platform console API that "just worked" out of the box.  I've 
had to jump through various hoops to get to where I am and don't think that 
other people should have to go through the same pain as I have.  

This is one of the reasons why I've been tidying up my package to make this as 
simple as possible for the next person.  I've now got to the stage where I have 
something that works for me, but it is almost certainly missing something.  
Maybe it's not good enough documentation, maybe there's some clunkiness left in 
the API due to the history of the project, maybe there's an even better way to 
represent terminals than what I've come up with so far?

I was hoping for feedback on this front rather than other ways I could recreate 
the curses package - unless of course, the general consensus is that this 
really is the way that Python should expose access to the terminal/console.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Oscar Benjamin
On 22 October 2015 at 11:56, Peter Brittain  wrote:
> On Thursday, October 22, 2015 at 10:24:11 AM UTC+1, Laura Creighton wrote:
>> Fredrik Lundh's console implementation
>> http://effbot.org/zone/console-handbook.htm
>> might be of interest in that case, but I think it is 'old versions
>> of windows only'.  But it's a different take on the abstraction
>> problem.  I haven't used it for something like 15 years now, though,
>> so can barely remember it ...
>
> Thanks, but I think this is already covered in my original post: I couldn't 
> use it directly due to the pip installation restriction.  I've now created a 
> working Windows implementation, so I don't need another mapping for win32.
>
> More generally, as these posts begin to show, there was no _simple_ way for 
> me to get a cross-platform console API that "just worked" out of the box.  
> I've had to jump through various hoops to get to where I am and don't think 
> that other people should have to go through the same pain as I have.

I've looked for this in the past and I also found that there was no
general solution that I could just pick and use for both Windows and
everything else. Even just writing a cross-platform getch function is
needlessly complicated.

> This is one of the reasons why I've been tidying up my package to make this 
> as simple as possible for the next person.  I've now got to the stage where I 
> have something that works for me, but it is almost certainly missing 
> something.  Maybe it's not good enough documentation, maybe there's some 
> clunkiness left in the API due to the history of the project, maybe there's 
> an even better way to represent terminals than what I've come up with so far?
>
> I was hoping for feedback on this front rather than other ways I could 
> recreate the curses package - unless of course, the general consensus is that 
> this really is the way that Python should expose access to the 
> terminal/console.

Thanks for creating this. I will try it out when I next want to create
something like this and give some feedback then. I don't really know
when that will be though...

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Defamation

2015-10-22 Thread Laura Creighton
In a message of Thu, 22 Oct 2015 11:33:13 +0100, Oscar Benjamin writes:
>I have a feeling that something may have changed recently but
>certainly until a few years ago we used to have lots of cases of
>"libel tourism" in the UK. This is where someone decides to bring a
>libel case which has nothing to do with the UK before the UK courts
>because libel law here is steeped in favour of the litigant. UK law
>requires the case to have a connection to the UK but the courts were
>apparently prepared to accept very tenuous connections (presumably
>because the whole business could function as an "export" bringing
>loads of money to all the lawyers involved). AFAIK these cases usually
>concerned foreign newspaper websites rather than something like the
>archive here though.

Very interesting.  Any prominent court decisions that could be scaring
them off?  One thing to recall is that 'who/what can be defamed' 
varies a lot.  In Sweden you cannot defame a corporation.  The
defamation regulations in the Penal Code only apply to private
individuals.  If you cannot bleed, you cannot be defamed.  In certain
situations the Swedish Marketing Act may be used to stop defamation of
a corporate entity -- if a rival has, without basis, tainted a rival's
reputation -- but this sort of protection is limited.  This makes
Sweden an attractive place to discuss Mosanto, and their evil
practices, even though, like a lot of places Sweden's defamation
law does not have a clause saying roughly 'if it is true, it isn't
defamation'.  Just 'intent to villify' is enough.  

Laura
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: select.poll and ppoll

2015-10-22 Thread Marko Rauhamaa
Steven D'Aprano :

> I have select.poll, but I'm looking for something like ppoll instead. From 
> the Linux man page:
>
>ppoll()
>The relationship between poll() and ppoll() is analogous to the
>relationship  between  select(2)  and  pselect(2):  like  pselect(2), 
>ppoll()  allows  an  application to safely wait until either a file
>descriptor becomes ready or until a signal is caught.
>
> Technically, *I* don't want this, it's one of my work-colleagues. He
> says:
>
> "My high-level goal is to run a callback function whenever the alsa
> mixer level changes. The C alsa API provides
> snd_mixer_elem_set_callback, but the Python API (import alsaaudio)
> seems to need me to get poll(2) descriptors"

I've never used ppoll or pselect. They are used to fix naive signal
handling in a main loop:

while not signaled:
select.poll(...)
...

The loop suffers from a race condition: the "signaled" flag, which is
set by a signal handler, might change between "while" and "select.poll".

The standard, classic way to solve the race condition is to replace the
"signaled" flag with an internal pipe. The signal handler writes a byte
into the pipe and select.poll() wakes up when the pipe becomes readable.
IOW, ppoll() and pselect() are not needed.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Gisle Vanem

"Peter Brittain"  wrote:


I have recently been working on a terminal/console animation package
(https://github.com/peterbrittain/asciimatics). 


I tried installing your package with "pip.exe -v install asciimatics".
Some problem with pypiwin32 it seems:

Installing collected packages: pypiwin32, future, Pillow, pyfiglet, asciimatics

 Cleaning up...
 Exception:
 Traceback (most recent call last):
   File 
"g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\basecommand.py",
 line 232, in main
 status = self.run(options, args)
   File 
"g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\commands\install.py",
 line 347, in run
 root=options.root_path,
   File 
"g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\req\req_set.py",
 line 549, in install
 **kwargs
   File 
"g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\req\req_install.py",
 line 751, in install
 self.move_wheel_files(self.source_dir, root=root)
   File 
"g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\req\req_install.py",
 line 960, in move_wheel_files
 isolated=self.isolated,
   File 
"g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\wheel.py", 
line 234, in move_wheel_files
 clobber(source, lib_dir, True)
   File 
"g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\wheel.py", 
line 212, in clobber
 shutil.copyfile(srcfile, destfile)
   File "g:\Programfiler\Python27\lib\shutil.py", line 83, in copyfile
 with open(dst, 'wb') as fdst:
 IOError: [Errno 13] Permission denied: 
'g:\\Programfiler\\Python27\\Lib\\site-packages\\win32\\win32api.pyd'

-

BTW, this is on Python 2.7.9 on Win-XP SP3.

--gv
--
https://mail.python.org/mailman/listinfo/python-list


Re: Defamation

2015-10-22 Thread Laura Creighton
The UK libel reform act of 2013, I see, may be responsible for 
the decline in libel tourism.
http://www.libelreform.org/

Laura

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


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Peter Brittain
On Thursday, October 22, 2015 at 12:25:09 PM UTC+1, Gisle Vanem wrote:
> I tried installing your package with "pip.exe -v install asciimatics".
> Some problem with pypiwin32 it seems:
> 
> Installing collected packages: pypiwin32, future, Pillow, pyfiglet, 
> asciimatics
> 
>   Cleaning up...
>   Exception:
>   Traceback (most recent call last):
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\basecommand.py",
>  line 232, in main
>   status = self.run(options, args)
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\commands\install.py",
>  line 347, in run
>   root=options.root_path,
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\req\req_set.py",
>  line 549, in install
>   **kwargs
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\req\req_install.py",
>  line 751, in install
>   self.move_wheel_files(self.source_dir, root=root)
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\req\req_install.py",
>  line 960, in move_wheel_files
>   isolated=self.isolated,
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\wheel.py",
>  line 234, in move_wheel_files
>   clobber(source, lib_dir, True)
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\wheel.py",
>  line 212, in clobber
>   shutil.copyfile(srcfile, destfile)
> File "g:\Programfiler\Python27\lib\shutil.py", line 83, in copyfile
>   with open(dst, 'wb') as fdst:
>   IOError: [Errno 13] Permission denied: 
> 'g:\\Programfiler\\Python27\\Lib\\site-packages\\win32\\win32api.pyd'
> 
> -
> 
> BTW, this is on Python 2.7.9 on Win-XP SP3.
> 
> --gv

That's a new one on me.  The pypiwin32 package has installed fine for me on 
Python 3 in  Windows 7, 8 and 10.  Sadly I don't have ready access to an XP 
machine, so can't easily try a repro myself...  Does the file already exist, or 
are you lacking permissions to update the folder?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Defamation

2015-10-22 Thread Oscar Benjamin
On 22 October 2015 at 12:36, Laura Creighton  wrote:
>
> The UK libel reform act of 2013, I see, may be responsible for
> the decline in libel tourism.
> http://www.libelreform.org/

Yes I think so. From Wikipedia:
"""
A court does not have jurisdiction to hear and determine any action,
unless the court is satisfied that, of all the places in which the
statement complained of has been published, England and Wales is
clearly the most appropriate.
"""
https://en.wikipedia.org/wiki/Defamation_Act_2013#Jurisdiction

Libel tourism cases often would occur for a foreign publication that
was not distributed in printed form in the UK but had a website that
was globally accessible. A case might be brought on the strength of
say a hundred UK downloads from the website despite the publication
having a printed circulation of hundreds of thousands in some other
country (and the authors and complainants all being in the same other
country). I can't recall any specific cases right now though...

If the court needs to be satisfied that England and Wales is the
_most_ appropriate place to hear the case then this would rule out the
libel tourism cases I used to hear about. Apparently this only applies
to England and Wales though leaving Northern Ireland as a new
preferred location for libel tourism.

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Chris Angelico
On Thu, Oct 22, 2015 at 10:22 PM, Gisle Vanem  wrote:
>  IOError: [Errno 13] Permission denied:
> 'g:\\Programfiler\\Python27\\Lib\\site-packages\\win32\\win32api.pyd'
>
> -
>
> BTW, this is on Python 2.7.9 on Win-XP SP3.

Does that file exist? A .pyd file is a DLL, so if it already exists
and is in use, it's entirely possible it can't be overwritten (eg to
upgrade it).

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


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Gisle Vanem

"Chris Angelico"  wrote:


On Thu, Oct 22, 2015 at 10:22 PM, Gisle Vanem  wrote:

 IOError: [Errno 13] Permission denied:
'g:\\Programfiler\\Python27\\Lib\\site-packages\\win32\\win32api.pyd'

-

BTW, this is on Python 2.7.9 on Win-XP SP3.


Does that file exist? A .pyd file is a DLL, so if it already exists
and is in use, it's entirely possible it can't be overwritten (eg to
upgrade it).


It exists all right and I do have full access to that folder.

I think the Errno 13 (=EACCESS) is due to another module (WConio.pyd) 
that seems gets loaded via my site-customize.py is using this
win32api.pyd. Hence it's is in use and shutil fails in updating it. 


--gv

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


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Chris Angelico
On Thu, Oct 22, 2015 at 11:42 PM, Gisle Vanem  wrote:
> I think the Errno 13 (=EACCESS) is due to another module (WConio.pyd) that
> seems gets loaded via my site-customize.py is using this
> win32api.pyd. Hence it's is in use and shutil fails in updating it.

Ah, that might well be it. Does it work if you run:

python -S -m pip install --upgrade win32api

? That might stop win32api.pyd from getting loaded.

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


Pandas' loading a CSV file problem

2015-10-22 Thread Ek Esawi
Here is the whole output. EKE

Traceback (most recent call last):

  File "C:\Users\EK Esawi\Anaconda3\Scripts\MyFile.py", line 3, in 

f = pd.read_csv('c:/Users/EK Esawi/My Documents/Temp/GOSATemp1.csv')

  File "C:\Users\EK
Esawi\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 474, in
parser_f

return _read(filepath_or_buffer, kwds)

  File "C:\Users\EK
Esawi\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 260, in _read

return parser.read()

  File "C:\Users\EK
Esawi\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 721, in read

ret = self._engine.read(nrows)

  File "C:\Users\EK
Esawi\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 1170, in read

data = self._reader.read(nrows)

  File "pandas\parser.pyx", line 769, in pandas.parser.TextReader.read
(pandas\parser.c:7544)

  File "pandas\parser.pyx", line 791, in
pandas.parser.TextReader._read_low_memory (pandas\parser.c:7784)

  File "pandas\parser.pyx", line 866, in
pandas.parser.TextReader._read_rows (pandas\parser.c:8617)

  File "pandas\parser.pyx", line 973, in
pandas.parser.TextReader._convert_column_data (pandas\parser.c:9928)

  File "pandas\parser.pyx", line 1033, in
pandas.parser.TextReader._convert_tokens (pandas\parser.c:10714)

  File "pandas\parser.pyx", line 1130, in
pandas.parser.TextReader._convert_with_dtype (pandas\parser.c:12118)

  File "pandas\parser.pyx", line 1150, in
pandas.parser.TextReader._string_convert (pandas\parser.c:12332)

  File "pandas\parser.pyx", line 1382, in pandas.parser._string_box_utf8
(pandas\parser.c:17655)

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 8:
invalid start byte
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Oscar Benjamin
On 22 October 2015 at 13:42, Gisle Vanem  wrote:
> "Chris Angelico"  wrote:
>
>> On Thu, Oct 22, 2015 at 10:22 PM, Gisle Vanem  wrote:
>>>
>>>  IOError: [Errno 13] Permission denied:
>>> 'g:\\Programfiler\\Python27\\Lib\\site-packages\\win32\\win32api.pyd'
>>>
>>> -
>>>
>>> BTW, this is on Python 2.7.9 on Win-XP SP3.
>>
>>
>> Does that file exist? A .pyd file is a DLL, so if it already exists
>> and is in use, it's entirely possible it can't be overwritten (eg to
>> upgrade it).
>
>
> It exists all right and I do have full access to that folder.
>
> I think the Errno 13 (=EACCESS) is due to another module (WConio.pyd) that
> seems gets loaded via my site-customize.py is using this
> win32api.pyd. Hence it's is in use and shutil fails in updating it.

Does it work if you ask pip to install each dependency separately?
i.e. you could just run pip install pypiwin32.

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas' loading a CSV file problem

2015-10-22 Thread Michiel Overtoom
Hi Ek,

> On 22 Oct 2015, at 14:44, Ek Esawi  wrote:
> 
> f = pd.read_csv('c:/Users/EK Esawi/My Documents/Temp/GOSATemp1.csv')
> File "pandas\parser.pyx", line 1382, in pandas.parser._string_box_utf8 
> (pandas\parser.c:17655)
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 8: 
> invalid start byte

I guess you're on Windows and your CSV file is encoded as Windows-1252. Unless 
you tell Pandas this it'll assume your file is utf-8 encoded.

Try this:

   f = pd.read_csv('c:/Users/EK Esawi/My Documents/Temp/GOSATemp1.csv', 
encoding='windows-1252')

Greetings,




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


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Gisle Vanem

"Chris Angelico"  wrote:


Ah, that might well be it. Does it work if you run:

python -S -m pip install --upgrade win32api


Hm. 
 c:\>python2 -S -m pip install --upgrade win32api

 Collecting win32api
   Could not find any downloads that satisfy the requirement win32api
   No distributions at all found for win32api

I think you mean 'pypiwin32'. Since:
 c:\>python2 -S -m pip install --upgrade pypiwin32
 Requirement already up-to-date: pypiwin32 in 
g:\programfiler\python27\lib\site-packages

So now, running 'setup.py install' in AsciiMatics' directory, all seems 
to install okay. 


But the samples have problems if launched from the sample directory!
It seems to be related to my Windows associations for .png files; 
'python2 win_demo.py' launches this:
 g:\util\Graphics\IrfanView\i_view32.exe 
 G:\Programfiler\Python27\Lib\site-packages\AsciiMatics\samples\python.png 
 G:\Programfiler\Python27\Lib\site-packages\AsciiMatics\samples\win_demo.py


Yes, all on 1 line. Notice the 'win_demo.py' is last!!?? But 
'python2 samples\win_demo.py' works fine (see attached screen-shot).

Allthough it messes up the screen's scrollback buffer. Similar to how
most PDcurses do on Windows :-(


--gv-- 
https://mail.python.org/mailman/listinfo/python-list


Pandas' loading a CSV file problem

2015-10-22 Thread Ek Esawi
Thanks you all for the input. Michiel's suggestion worked. At first It gave
me an error about "low_memory"; once i sat low_memory to false, it worked.

I am new to pandas and i am working on a 20,000 record csv file with mixed
data types and in many cases, one entry (cell)  has a combination of string
and numeric values which will eventually be separated.

Thanks again-EK
-- 
https://mail.python.org/mailman/listinfo/python-list


my first script for the GoPiGo

2015-10-22 Thread input/ldompeling
I want that this script runs to times from the upper line to the buttom line.
I tried with for x in range(2): but that didn't work
The GoPiGo is a small robot on wheels.

The API codes are here: 
http://www.dexterindustries.com/GoPiGo/programming/python-programming-for-the-
raspberry-pi-gopigo/


from gopigo import *
import time

for x in range (2):
mindist = 70
servo(120)
time.sleep(2)
fwd()
stop()
time.sleep(2)
bwd()
stop()
if mindist > us_dist(15):
bwd()
stop
print x


-- 
- --- -- -
Posted with NewsLeecher v7.0 Beta 2
Web @ http://www.newsleecher.com/?usenet
--- -  -- -

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


Re: Defamation

2015-10-22 Thread Steven D'Aprano
On Thu, 22 Oct 2015 11:45 am, John O'Hagan wrote:

> On Wed, 21 Oct 2015 00:09:18 +1100
> Steven D'Aprano  wrote:
> 
>  
>> I don't believe that the Python mailing list archives are hosted in a
>> country under the jurisdiction of European Law. If I'm right, then
>> removing posts sets a dangerous precedent of obeying laws in foreign
>> countries that don't apply.
> 
> For better or worse, that's not how defamation law works. Generally,
> the defaming is regarded as happening where the material is read, i.e.
> at the point of download. The location of upload, hosting etc is
> irrelevant, although the uploader and the host can both be liable
> along with the author. Of course, the point is moot if none of those
> people has assets in that jurisdiction.
> 
> For example:
> 
> https://en.wikipedia.org/wiki/Dow_Jones_%26_Co_Inc_v_Gutnick


You can't generalise from a ruling in one state (Australia) when other
country's legal systems may (and almost certainly are) different. For
example, the US explicitly prohibits their courts from enforcing foreign
libel or defamation suits unless the other country provides at least as
much protection for free speech as does the US.

Oh, and for what it's worth, I remember that case very well, and I think the
judges were terribly naive in some of their comments. Specifically, they
poo-pooed the suggestion that the ruling could lead to a flurry of
defamation actions in Australia against publications all over the world. If
they were right, it was more by good luck than by good reasoning: the UK,
not Australia, was the go-to place for "libel tourism".

https://en.wikipedia.org/wiki/Libel_tourism


> On the specific point, I think it's possible to agree with both
> Steven and Laura. It's a bad idea to obey laws that don't apply to
> you if you'd rather not. It's also a good idea if possible to remove
> defamatory material, not because it might be illegal, but because it's
> defamatory.

Defamatory according to whom, according to what standards?

Standards vary greatly. It is hard to prove defamation in the US, it was
ridiculously easy in the UK (things are better since the Simon Singh case
inspired the UK government to change the law), and in places like Singapore
defamation is a thinly disguised weapons for the ruling party to use to
attack political opponents and critics, and protect themselves from having
their corrupt activities revealed.

http://singaporepress.pbworks.com/w/page/11489265/Defamation%20Act
http://www.irrawaddy.org/asia/in-singapore-the-economics-of-defamation.html
http://singaporedissident.blogspot.com.au/2012/02/lee-family-will-not-sue-for-defamation.html
http://www.singapore-window.org/sw02/020926au.htm

Including ordinary bloggers:

http://blogs.wsj.com/indonesiarealtime/2014/06/04/libel-suit-turns-singapore-blogger-into-underdog-for-pensioners/




-- 
Steven

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


Re: my first script for the GoPiGo

2015-10-22 Thread MRAB

On 2015-10-22 16:07, input/ldompel...@casema.nl wrote:

I want that this script runs to times from the upper line to the buttom line.
I tried with for x in range(2): but that didn't work


You say "didn't work", but in what way didn't it work?


The GoPiGo is a small robot on wheels.

The API codes are here:
http://www.dexterindustries.com/GoPiGo/programming/python-programming-for-the-
raspberry-pi-gopigo/


from gopigo import *
import time

for x in range (2):


The lines to be repeated should be indented more than the 'for' line.


mindist = 70
servo(120)
time.sleep(2)
fwd()
stop()
time.sleep(2)
bwd()
stop()
if mindist > us_dist(15):
 bwd()
 stop
 print x



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


Re: my first script for the GoPiGo

2015-10-22 Thread input/ldompeling
In reply to "MRAB" who wrote the following:

> On 2015-10-22 16:07, input/ldompel...@casema.nl wrote:
> > I want that this script runs to times from the upper line to the buttom 
> > line.
> > I tried with for x in range(2): but that didn't work
> 
> You say "didn't work", but in what way didn't it work?
> 
> > The GoPiGo is a small robot on wheels.
> > 
> > The API codes are here:
> > http://www.dexterindustries.com/GoPiGo/programming/
> > python-programming-for-the-
> > raspberry-pi-gopigo/
> > 
> > 
> > from gopigo import *
> > import time
> > 
Thanks or the reply.

I mean that i want this script running two times.
So the first line is mindist = 70 
And the last line is print x
And that two times
So that the robut continues moving two times in this script, from the upperline 
to the bottum line two times.


> > for x in range (2):
> 
> The lines to be repeated should be indented more than the 'for' line.
> 
> > mindist = 70
> > servo(120)
> > time.sleep(2)
> > fwd()
> > stop()
> > time.sleep(2)
> > bwd()
> > stop()
> > if mindist > us_dist(15):
> >  bwd()
> >  stop
> >  print x
> >




-- 
- --- -- -
Posted with NewsLeecher v7.0 Beta 2
Web @ http://www.newsleecher.com/?usenet
--- -  -- -

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


Re: my first script for the GoPiGo

2015-10-22 Thread MRAB

On 2015-10-22 16:45, input/ldompel...@casema.nl wrote:

In reply to "MRAB" who wrote the following:


On 2015-10-22 16:07, input/ldompel...@casema.nl wrote:
> I want that this script runs to times from the upper line to the buttom
> line.
> I tried with for x in range(2): but that didn't work

You say "didn't work", but in what way didn't it work?

> The GoPiGo is a small robot on wheels.
>
> The API codes are here:
> http://www.dexterindustries.com/GoPiGo/programming/
> python-programming-for-the-
> raspberry-pi-gopigo/
>
>
> from gopigo import *
> import time
>

Thanks or the reply.

I mean that i want this script running two times.
So the first line is mindist = 70
And the last line is print x
And that two times
So that the robut continues moving two times in this script, from the upperline
to the bottum line two times.


Then just indent those lines and precede them with the 'for' line.



> for x in range (2):

The lines to be repeated should be indented more than the 'for' line.

> mindist = 70
> servo(120)
> time.sleep(2)
> fwd()
> stop()
> time.sleep(2)
> bwd()
> stop()
> if mindist > us_dist(15):
>  bwd()
>  stop
>  print x
>


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


Re: PyPi bug?

2015-10-22 Thread Kev Dwyer
Nagy László Zsolt wrote:

> Today I have tried to register and upload a new package by executing
> 
> setup.py register
> 
> 
> I was asked if I want to save the creditentials in a .pypirc file and I
> answered yes.
> 
> Next I wanted to run
> 
> setup.py upload
> 
> and I got this error:
> 
> 
> Traceback (most recent call last):
>   File "C:\Python\Projects\some_package\setup.py", line 15, in 
> classifiers=['Topic :: Security', 'Topic :: Internet :: WWW/HTTP'],
>   File "C:\Python35\lib\distutils\core.py", line 148, in setup
> dist.run_commands()
>   File "C:\Python35\lib\distutils\dist.py", line 955, in run_commands
> self.run_command(cmd)
>   File "C:\Python35\lib\distutils\dist.py", line 973, in run_command
> cmd_obj.ensure_finalized()
>   File "C:\Python35\lib\distutils\cmd.py", line 107, in ensure_finalized
> self.finalize_options()
>   File "C:\Python35\lib\distutils\command\upload.py", line 46, in
> finalize_options
> config = self._read_pypirc()
>   File "C:\Python35\lib\distutils\config.py", line 83, in _read_pypirc
> current[key] = config.get(server, key)
>   File "C:\Python35\lib\configparser.py", line 798, in get
> d)
>   File "C:\Python35\lib\configparser.py", line 396, in before_get
> self._interpolate_some(parser, option, L, value, section, defaults, 1)
>   File "C:\Python35\lib\configparser.py", line 445, in _interpolate_some
> "found: %r" % (rest,))
> configparser.InterpolationSyntaxError: '%' must be followed by '%' or
> '(', found
> : *'
> 
> Instead of the many stars, of course there is the password. The problem
> might be that the password contains a % character, and it was
> incorrectly saved by distutils.
> 
> Can somebody please confirm that this is a bug in distutils? The we
> probably have to submit a bug report.
> 
> Thanks,
> 
>Laszlo


Could be http://bugs.python.org/issue20120 ?



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


Re: PyPi bug?

2015-10-22 Thread Nagy László Zsolt

>
> Could be http://bugs.python.org/issue20120 ?
Almost. Except that the password was saved incorrectly by distutils
itself. So maybe the read part should not be fixed, but the write part
should.
-- 
https://mail.python.org/mailman/listinfo/python-list


OT Creepy Puzzle

2015-10-22 Thread Seymore4Head
http://gadgetzz.com/2015/10/12/this-creepy-puzzle-arrived-in-our-mail/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: UNABLE TO GET IDLE TO RUN

2015-10-22 Thread Terry Reedy

On 10/21/2015 11:24 AM, Terry Alexander via Python-list wrote:


I have tried installing both Python 2.7 and 3.5, and in both cases I
cannot get IDLE to work. I received the following message both times:


What OS? Windows? which version?  How did you start IDLE?  Start menu 
icon?  Command line?



IDLE’s subprocess didn’t make connection.Either IDLE can’t start a
subprocess or personal firewall software is blocking the connection.

I am running Norton, and disabled it, but still IDLE will not run. Any
suggestions?


Don't shout with ALL CAPS in the subject line.  It usually indicates 
spam.  I already know that this problem is very frustrating.


Firewalls are seldom the problems anymore.  I occasionally saw this on 
Win 7 when restarting, but never on startup, and never more than once or 
twice in a session.


What's left is misconfiguration of your network interface that prevents 
a loopback connection.  There might be answers on Stackoverflow that 
would help, depending on your OS.


In the meanwhile, you can start IDLE with the -n option.  Either use a 
command line or create an 'IDLE -n' icon.  Again, details depend on 
exact OS.


--
Terry Jan Reedy


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


warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.

2015-10-22 Thread caspar
Hello,

I'm trying to install the yowsup2-2.4.2.tar from pypi, but my system gives
warnings and errors:

warning: GMP or MPIR library not found; Not building
Crypto.PublicKey._fastmath.

more in detail:

running build_ext
building 'Crypto.Random.OSRNG.winrandom' extension
warning: GMP or MPIR library not found; Not building
Crypto.PublicKey._fastmath.
error: [WinError 2] Het systeem kan het opgegeven bestand niet vinden
(dutch for: system can't find a named file)


Command "c:\users\ptn\appdata\local\programs\python\python35-32\python.exe
-c "import setuptools,
tokenize;__file__='C:\\Users\\ptn\\AppData\\Local\\Temp\\pip-build-hwbc57ud\\pycrypto\\setup.py';exec(compile(getattr(tokenize,
'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record
C:\Users\ptn\AppData\Local\Temp\pip-_383sc3p-record\install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in
C:\Users\ptn\AppData\Local\Temp\pip-build-hwbc57ud\pycrypto

I'm using windows-10-X64 and the latest version: python-3.5.0.

How to fix this problem? Or should I run another (lower) version of python?

Please help.

Kind regards,
Caspar
-- 
https://mail.python.org/mailman/listinfo/python-list


Catch Android Exception in Python 2.7.6

2015-10-22 Thread Karina Villanes
Hi everybody,
I'm writing an python script test for mobile App (for Android). One of them
is to test memory device. I have one test to try to install an APK on
device that doesn't have enough memory, so I want to catch this exception:

03:27:35 E/ddms: transfer error: No space left on device
03:27:35 E/Device: Error during Sync: No space left on device
151022 15:27:35.279:S [MainThread]
[com.android.chimpchat.adb.AdbChimpDevice] Error installing package:
/home/apks_to_test/App-name.apk
151022 15:27:35.279:S [MainThread]
[com.android.chimpchat.adb.AdbChimpDevice]
*com.android.ddmlib.InstallException:
No space left on device*

and save on a file(txt) to show the user in a cleaner way like

*"Your device doesn't have enough memory"*
*I want to cath "*
*com.android.ddmlib.InstallException: No space left on device" Is it
possible. This is my code:*

print "Installing APK"
for apk in glob.glob(self.apkfolder + '/*.apk'):
   try:
   self.device.installPackage(apk)
   except IOError, error:
   print "Error Message "
   print(error)


But It’s not working. Some ideas?
I'm using Ubuntu 14.04
Thanks!

-- 
Att.
*Isabel Karina*
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.

2015-10-22 Thread Paul Rubin
cas...@walboomers.nl writes:
> warning: GMP or MPIR library not found; Not building 
> Crypto.PublicKey._fastmath.
> How to fix this problem? Or should I run another (lower) version of python?

See if the program works anyway without _fastmath.  It would use the
built-in Python arithmetic which is slower but usable unless you have
high performance requirements.  According to my benchmarks (a long time
ago on a 32-bit x86) GMP was about 4x faster than Python's bigints.  But
your program isn't likely to spend that much of its time doing bignum
math.
-- 
https://mail.python.org/mailman/listinfo/python-list