Python Crypto Singature do not support Android???

2014-09-05 Thread Frank Liou
I use Privatekey sign a signature by android and then send to python python can't use public key to verify and python signature result all is number but android is number and english words is that no support?? -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Crypto Singature do not support Android???

2014-09-05 Thread Chris Angelico
On Fri, Sep 5, 2014 at 5:02 PM, Frank Liou wrote: > I use Privatekey sign a signature by android > > and then send to python > > python can't use public key to verify > > and > > python signature result all is number > > but > > android is number and english words > > is that no support?? It woul

Re: Python Crypto Singature do not support Android???

2014-09-05 Thread Frank Liou
Sorry!! here is my code python : msg = '123' msg = msg.encode('utf-8') digest = SHA.new(msg).digest() signature = APP_key_Private.sign(digest, '') signature like: (3313609575189770456309776952388055366479183814159935747487353823698464644111856144652004406811762087026328804664486509214841694613

Run an http server on Apache without wsgi?

2014-09-05 Thread Frank Millman
Hi all My AccInABox project runs an http server. Previously I used the cherry.py wsgiserver, but I have now switched to asyncio. I tried to use the wsgi interface, but I have a particular requirement and found that wsgi got in the way, so I dropped it and now handle all requests directly. Now

Re: Python Crypto Singature do not support Android???

2014-09-05 Thread Chris Angelico
On Fri, Sep 5, 2014 at 5:23 PM, Frank Liou wrote: > here is my code > > python : > > msg = '123' > msg = msg.encode('utf-8') > digest = SHA.new(msg).digest() > signature = APP_key_Private.sign(digest, '') That code is incomplete, I can't run it. Ditto your Java code. But what seems to be happenin

Re: How to turn a string into a list of integers?

2014-09-05 Thread cl
Joshua Landau wrote: > On 3 September 2014 15:48, wrote: > > Peter Otten <__pete...@web.de> wrote: > >> >>> [ord(c) for c in "This is a string"] > >> [84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 115, 116, 114, 105, 110, 103] > >> > >> There are other ways, but you have to describe the use case

reading file in for loop

2014-09-05 Thread loial
If I read a file using a for loop, as follows, is the file left open if I execute a break in the for loop? for line in open(myFile).readlines(): if something: break -- https://mail.python.org/mailman/listinfo/python-list

Re: reading file in for loop

2014-09-05 Thread Chris Angelico
On Fri, Sep 5, 2014 at 8:20 PM, loial wrote: > If I read a file using a for loop, as follows, is the file left open if I > execute a break in the for loop? > > > for line in open(myFile).readlines(): > > if something: > break It'll be closed when the object expires. With CPython, tha

Re: reading file in for loop

2014-09-05 Thread Peter Otten
loial wrote: > If I read a file using a for loop, as follows, is the file left open if I > execute a break in the for loop? > > > for line in open(myFile).readlines(): > > if something: > break Whether the file is left open has nothing to do with how you leave the loop. The way yo

“Eric Python 3 (& 2) IDE” Tech.Doc: How useful?

2014-09-05 Thread Pietro Moras
So to schedule my next year's “free” (in all senses) activity, I'd appreciate your remarks about your perceived practical usefulness of the Tech. Documentation of Eric advanced Python IDE, as available at URL: http://eric-ide.python-projects.org/eric-documentation.html For private answers: [S

Re: Raspberry pi, python and robotics

2014-09-05 Thread BartC
"Gregory Ewing" wrote in message news:c6nv2hf8q6...@mid.individual.net... Rob Gaddi wrote: otherwise getting up and running will cost you a solid $1200 just in gear. While having fancy gear certainly helps, it's not *strictly* necessary. When I first started dabbling in electronics, the mos

Re: I have tried and errored a reasonable amount of times

2014-09-05 Thread Grant Edwards
On 2014-09-05, Denis McMahon wrote: > On Thu, 04 Sep 2014 21:42:56 +1000, Chris Angelico wrote: >> On Thu, Sep 4, 2014 at 9:17 PM, Denis McMahon >> wrote: >>> On Wed, 03 Sep 2014 07:16:34 +, Steven D'Aprano wrote: >>> Who uses + for disjunction (∨ OR) and concatenation for conjunction >

My backwards logic

2014-09-05 Thread Seymore4Head
I'm still doing practice problems. I haven't heard from the library on any of the books I have requested. http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html This is not a hard problem, but it got me to thinking a little. A prime number will divide by one and its

Re: I have tried and errored a reasonable amount of times

2014-09-05 Thread Marko Rauhamaa
Grant Edwards : > Who uses + for disjunction (∨ OR) and concatenation for > conjunction (∧ AND)? That's crazy notation. > > AFAIK, that's the standard notation in both CS and EE university > classes in the US also: + for 'or' and dot or abuttal for 'and'. Besides, it's no crazier for Bool

Re: My backwards logic

2014-09-05 Thread MRAB
On 2014-09-05 17:48, Seymore4Head wrote: I'm still doing practice problems. I haven't heard from the library on any of the books I have requested. http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html This is not a hard problem, but it got me to thinking a little.

Re: Storing instances using jsonpickle

2014-09-05 Thread MRAB
On 2014-09-04 06:17, Chris Angelico wrote: On Thu, Sep 4, 2014 at 9:39 AM, MRAB wrote: I occasionally think about a superset of JSON, called, say, "pyson" ... ah, name already taken! :-( While I'm somewhat sympathetic to the concept, there are some parts of your description that I disagree wi

Re: My backwards logic

2014-09-05 Thread Bob Gailer
Bob gailer On Sep 5, 2014 12:51 PM, "Seymore4Head" wrote: > > I'm still doing practice problems. I haven't heard from the library > on any of the books I have requested. > > http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html > > This is not a hard problem, but it

Re: My backwards logic

2014-09-05 Thread Ethan Furman
On 09/05/2014 09:48 AM, Seymore4Head wrote: I'm still doing practice problems. I haven't heard from the library on any of the books I have requested. http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html This is not a hard problem, but it got me to thinking a litt

Re: My backwards logic

2014-09-05 Thread Chris Kaynor
On Fri, Sep 5, 2014 at 9:48 AM, Seymore4Head wrote: > I'm still doing practice problems. I haven't heard from the library > on any of the books I have requested. > > > http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html > > This is not a hard problem, but it got m

Re: My backwards logic

2014-09-05 Thread John Gordon
In <1enj0att6bkrnvb81rhma5dbuk3h28a...@4ax.com> Seymore4Head writes: > I'm still doing practice problems. I haven't heard from the library > on any of the books I have requested. > http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html > This is not a hard problem

Re:My backwards logic

2014-09-05 Thread Dave Angel
Seymore4Head Wrote in message: > I'm still doing practice problems. I haven't heard from the library > on any of the books I have requested. > > http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html > > This is not a hard problem, but it got me to thinking a little

Re: My backwards logic

2014-09-05 Thread Ian Kelly
On Fri, Sep 5, 2014 at 11:08 AM, Ethan Furman wrote: > Python's 'for' loop has a handy 'else' extension which is perfect for the > search-type of 'for' loop: > >while True: > a=random.randrange(1,8) > print (a) > for x in range(2,a): > if a%x==0: >

Re: Storing instances using jsonpickle

2014-09-05 Thread Marko Rauhamaa
MRAB : > Therefore, if you want it to be able to drop it into Python's REPL, it > won't be compatible with JSON anyway! (Well, not unless you define > 'true' and 'false' first.) Sigh. I was so hopeful JSON would be great. Unfortunately, it flopped by requiring the parser to heuristically support

Re: Storing instances using jsonpickle

2014-09-05 Thread Ned Batchelder
On 9/5/14 1:16 PM, Marko Rauhamaa wrote: MRAB : Therefore, if you want it to be able to drop it into Python's REPL, it won't be compatible with JSON anyway! (Well, not unless you define 'true' and 'false' first.) Sigh. I was so hopeful JSON would be great. Unfortunately, it flopped by requiri

Re: My backwards logic

2014-09-05 Thread Juan Christian
I made this code just for fun and learning, it's working, but would this be a good approach? Thanks. import sys def prime_checker(start = 1, stop = 1): for number in range(start, stop + 1): divisors = [(number % x) for x in range(1, number + 1)] print("{n} prime? {r}".format(n = number, r = (div

Re: My backwards logic

2014-09-05 Thread Seymore4Head
On Fri, 05 Sep 2014 10:08:18 -0700, Ethan Furman wrote: >On 09/05/2014 09:48 AM, Seymore4Head wrote: >> I'm still doing practice problems. I haven't heard from the library >> on any of the books I have requested. >> >> http://www.practicepython.org/exercise/2014/04/16/11-check-primality-function

Re: How to turn a string into a list of integers?

2014-09-05 Thread Kurt Mueller
Am 05.09.2014 um 10:42 schrieb c...@isbd.net: > Joshua Landau wrote: >> On 3 September 2014 15:48, wrote: >>> Peter Otten <__pete...@web.de> wrote: >>> [ord(c) for c in "This is a string"] [84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 115, 116, 114, 105, 110, 103] There are

Re: Storing instances using jsonpickle

2014-09-05 Thread Marko Rauhamaa
Ned Batchelder : > I don't understand how JSON has flopped? The parser may be a bit more > complex (but not much, it isn't hard to examine the first few bytes), > but you're using off-the-shelf parsers anyway, so why are you > concerned by this? There are occasions where you need to take shortcut

Re: My backwards logic

2014-09-05 Thread Chris Kaynor
On Fri, Sep 5, 2014 at 10:44 AM, Seymore4Head wrote: > On Fri, 05 Sep 2014 10:08:18 -0700, Ethan Furman > wrote: > > >On 09/05/2014 09:48 AM, Seymore4Head wrote: > >> I'm still doing practice problems. I haven't heard from the library > >> on any of the books I have requested. > >> > >> > http:

Re: How to turn a string into a list of integers?

2014-09-05 Thread Chris “Kwpolska” Warrick
On Sep 5, 2014 7:57 PM, "Kurt Mueller" wrote: > Could someone please explain the following behavior to me: > Python 2.7.7, MacOS 10.9 Mavericks > > >>> import sys > >>> sys.getdefaultencoding() > 'ascii' > >>> [ord(c) for c in 'AÄ'] > [65, 195, 132] > >>> [ord(c) for c in u'AÄ'] > [65, 196] > > My

Re: My backwards logic

2014-09-05 Thread Ethan Furman
On 09/05/2014 10:17 AM, Ian Kelly wrote: I would not worry about the else clause as a beginner, as it's relatively unique to Python and tends to be somewhat confusing. Use a flag or refactor the function instead. I don't disagree with this, but early exposure to "for..else is for search loops"

Re: My backwards logic

2014-09-05 Thread MRAB
On 2014-09-05 18:35, Juan Christian wrote: I made this code just for fun and learning, it's working, but would this be a good approach? Thanks. import sys def prime_checker(start = 1, stop = 1): In Python, the standard is to use a half-open range. for number in range(start, stop + 1):

Re: Anyway to reduce size of pdf using python script.

2014-09-05 Thread kekeje
On Friday, February 1, 2013 8:03:41 PM UTC-5, access...@gmail.com wrote: > I have a batch file that exports ArcGIS pdf maps to a directory. I would like > to include a step in the script where the pdf file is reduced in size instead > of manually opening each file in Acrobat X Pro after the scrip

Re: How to turn a string into a list of integers?

2014-09-05 Thread Kurt Mueller
Am 05.09.2014 um 20:25 schrieb Chris “Kwpolska” Warrick : > On Sep 5, 2014 7:57 PM, "Kurt Mueller" wrote: > > Could someone please explain the following behavior to me: > > Python 2.7.7, MacOS 10.9 Mavericks > > > > >>> import sys > > >>> sys.getdefaultencoding() > > 'ascii' > > >>> [ord(c) for c

Re: Anyway to reduce size of pdf using python script.

2014-09-05 Thread Tim
On Friday, February 1, 2013 8:03:41 PM UTC-5, access...@gmail.com wrote: > I have a batch file that exports ArcGIS pdf maps to a directory. I would like > to include a step in the script where the pdf file is reduced in size instead > of manually opening each file in Acrobat X Pro after the scrip

Re: My backwards logic

2014-09-05 Thread Juan Christian
What's [snip] ?? On Fri, Sep 5, 2014 at 3:48 PM, MRAB wrote: > On 2014-09-05 18:35, Juan Christian wrote: > >> I made this code just for fun and learning, it's working, but would this >> be a good approach? Thanks. >> >> import sys >> >> >> def prime_checker(start = 1, stop = 1): >> > > In Pyth

Re: My backwards logic

2014-09-05 Thread Mark Lawrence
On 05/09/2014 20:34, Juan Christian wrote: What's [snip] ?? As in cut out or chopped out such that some of the original text has been removed. And please don't top post here, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.

Re: My backwards logic

2014-09-05 Thread Paul Rubin
Juan Christian writes: > I made this code just for fun and learning, it's working, but would > this be a good approach? Thanks. ... > ** ** for number in range(start, stop + 1): > ** ** ** ** divisors = [(number % x) for x in range(1, number + 1)] > ** ** ** ** ** ** print("{n} prime? {r}".fo

Re: How to turn a string into a list of integers?

2014-09-05 Thread Kurt Mueller
Am 05.09.2014 um 21:16 schrieb Kurt Mueller : > Am 05.09.2014 um 20:25 schrieb Chris “Kwpolska” Warrick : >> On Sep 5, 2014 7:57 PM, "Kurt Mueller" wrote: >>> Could someone please explain the following behavior to me: >>> Python 2.7.7, MacOS 10.9 Mavericks >>> >> import sys >> sys.getdefa

Re: Storing instances using jsonpickle

2014-09-05 Thread Ned Batchelder
On 9/5/14 2:04 PM, Marko Rauhamaa wrote: Ned Batchelder : I don't understand how JSON has flopped? The parser may be a bit more complex (but not much, it isn't hard to examine the first few bytes), but you're using off-the-shelf parsers anyway, so why are you concerned by this? There are occa

Re: Storing instances using jsonpickle

2014-09-05 Thread Marko Rauhamaa
Ned Batchelder : > I see what you mean about JSON, but you are mistaken about HTTP and > XML. Neither of them dictates the encoding of the data, and both of > them offer ways to declare the encoding. This means XML parsers must > be prepared for many different encodings. You can rest assured that

Re: My backwards logic

2014-09-05 Thread Ian Kelly
On Fri, Sep 5, 2014 at 11:44 AM, Seymore4Head wrote: > BTW since I am getting no grade, I much prefer the answer than a hint. > The best hint IMO is to tell me how you would do it. from math import ceil, sqrt def is_prime(n): if n < 2: return False if n % 2 == 0: return n

Re: My backwards logic

2014-09-05 Thread Seymore4Head
On Fri, 05 Sep 2014 12:48:56 -0400, Seymore4Head wrote: >I'm still doing practice problems. I haven't heard from the library >on any of the books I have requested. > >http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html > >This is not a hard problem, but it got me

Re: O'Reilly Python Certification

2014-09-05 Thread julian
On Wednesday, September 3, 2014 5:53:12 PM UTC-4, jaron...@gmail.com wrote: > Ethan, Steve, Tim, and others: > > > > I'm thinking of taking the program. How long, in hours, does it take to > complete all four Python courses? I'm currently taking the first out of four modules. I have extensive

Re: My backwards logic

2014-09-05 Thread Chris Kaynor
On Fri, Sep 5, 2014 at 2:49 PM, Seymore4Head wrote: > On Fri, 05 Sep 2014 12:48:56 -0400, Seymore4Head > wrote: > > >I'm still doing practice problems. I haven't heard from the library > >on any of the books I have requested. > > > > > http://www.practicepython.org/exercise/2014/04/16/11-check-

Re: Storing instances using jsonpickle

2014-09-05 Thread Irmen de Jong
On 5-9-2014 19:16, Marko Rauhamaa wrote: > Thus, ast.literal_eval() is superior to anything JSON has to offer. Incidentally, I've made a serialization library based on Python's literal expressions. It uses ast.literal_eval() to deserialize, and a bit of custom code to serialize Python objects:

Re: My backwards logic

2014-09-05 Thread Ian Kelly
On Fri, Sep 5, 2014 at 3:49 PM, Seymore4Head wrote: > I am sure this has already been done, but after it was pointed out > that you don't need to test for any number that multiplies by 2 it > made me think again. > > If you start with the list [3,5,7] and step through the list of all > remaining o

Re: My backwards logic

2014-09-05 Thread Seymore4Head
On Fri, 5 Sep 2014 15:14:41 -0700, Chris Kaynor wrote: >On Fri, Sep 5, 2014 at 2:49 PM, Seymore4Head >wrote: > >> On Fri, 05 Sep 2014 12:48:56 -0400, Seymore4Head >> wrote: >> >> >I'm still doing practice problems. I haven't heard from the library >> >on any of the books I have requested. >> >

Re: My backwards logic

2014-09-05 Thread Seymore4Head
On Fri, 5 Sep 2014 16:35:18 -0600, Ian Kelly wrote: >On Fri, Sep 5, 2014 at 3:49 PM, Seymore4Head > wrote: >> I am sure this has already been done, but after it was pointed out >> that you don't need to test for any number that multiplies by 2 it >> made me think again. >> >> If you start with th

Re: My backwards logic

2014-09-05 Thread Chris Angelico
On Sat, Sep 6, 2014 at 3:44 AM, Seymore4Head wrote: > BTW since I am getting no grade, I much prefer the answer than a hint. > The best hint IMO is to tell me how you would do it. But for your own learning, it's still better for you to do things yourself. Giving you the answer doesn't teach you n

Re: Storing instances using jsonpickle

2014-09-05 Thread Chris Angelico
On Sat, Sep 6, 2014 at 3:04 AM, MRAB wrote: > JSON has 'true' and 'false'. > > Python has 'True' and 'False'. > > Therefore, if you want it to be able to drop it into Python's REPL, it > won't be compatible with JSON anyway! (Well, not unless you define > 'true' and 'false' first.) This is a new

Re: My backwards logic

2014-09-05 Thread Rustom Mody
On Saturday, September 6, 2014 1:37:57 AM UTC+5:30, Paul Rubin wrote: > Juan Christian writes: > > I made this code just for fun and learning, it's working, but would > > this be a good approach? Thanks. ... > > ** ** for number in range(start, stop + 1): > > ** ** ** ** divisors = [(number %

Re: My backwards logic

2014-09-05 Thread Juan Christian
@Mark Lawrence: Sorry to ask, but what do you mean by "don't top post here, thanks.", I'm not familiar with mailing lists, so I may be doing something wrong and I don't know. On Fri, Sep 5, 2014 at 4:54 PM, Mark Lawrence wrote: > On 05/09/2014 20:34, Juan Christian wrote: > >> What's [snip] ??

Re: My backwards logic

2014-09-05 Thread Rustom Mody
On Saturday, September 6, 2014 7:25:10 AM UTC+5:30, Juan Christian wrote: > @Mark Lawrence: Sorry to ask, but what do you mean by "don't top post here, > thanks.", I'm not familiar with mailing lists, so I may be doing something > wrong and I don't know. Maybe better to say use this http://en.w

Posting style: interleaved responses (was: My backwards logic)

2014-09-05 Thread Ben Finney
Juan Christian writes: > @Mark Lawrence: Sorry to ask, but what do you mean by "don't top post > here, thanks.", I'm not familiar with mailing lists, so I may be doing > something wrong and I don't know. Please post your responses interleaved with the quoted material to which you're responding.

Re: Posting style: interleaved responses (was: My backwards logic)

2014-09-05 Thread Juan Christian
On Fri, Sep 5, 2014 at 11:37 PM, Ben Finney wrote: > Juan Christian writes: > > > @Mark Lawrence: Sorry to ask, but what do you mean by "don't top post > > here, thanks.", I'm not familiar with mailing lists, so I may be doing > > something wrong and I don't know. > > Please post your responses

Re: My backwards logic

2014-09-05 Thread Dave Angel
Seymore4Head Wrote in message: > On Fri, 05 Sep 2014 12:48:56 -0400, Seymore4Head > wrote: > > > If you start with the list [3,5,7] and step through the list of all > remaining odd numbers (step 2), and start appending numbers that won't > divide by numbers already appended in the list, that w

Re: Posting style: interleaved responses (was: My backwards logic)

2014-09-05 Thread Zachary Ware
On Fri, Sep 5, 2014 at 10:06 PM, Juan Christian wrote: > On Fri, Sep 5, 2014 at 11:37 PM, Ben Finney > wrote: >> >> Juan Christian writes: >> >> > @Mark Lawrence: Sorry to ask, but what do you mean by "don't top post >> > here, thanks.", I'm not familiar with mailing lists, so I may be doing >>

Re: How to turn a string into a list of integers?

2014-09-05 Thread Steven D'Aprano
Chris Angelico wrote: > On Fri, Sep 5, 2014 at 12:09 PM, Ian Kelly wrote: >> On Thu, Sep 4, 2014 at 6:12 PM, Chris Angelico wrote: >>> If it's a Unicode string (which is the default in Python 3), all >>> Unicode characters will work correctly. >> >> Assuming the library that needs this is expect

Re: How to turn a string into a list of integers?

2014-09-05 Thread Steven D'Aprano
Kurt Mueller wrote: > Could someone please explain the following behavior to me: > Python 2.7.7, MacOS 10.9 Mavericks > import sys sys.getdefaultencoding() > 'ascii' That's technically known as a "lie", since if it were *really* ASCII it would refuse to deal with characters with the hi

Re: Run an http server on Apache without wsgi?

2014-09-05 Thread dieter
"Frank Millman" writes: > My AccInABox project runs an http server. Previously I used the cherry.py > wsgiserver, but I have now switched to asyncio. > > I tried to use the wsgi interface, but I have a particular requirement and > found that wsgi got in the way, so I dropped it and now handle a

Re: Anyway to reduce size of pdf using python script.

2014-09-05 Thread dieter
kek...@gmail.com writes: > On Friday, February 1, 2013 8:03:41 PM UTC-5, access...@gmail.com wrote: >> I have a batch file that exports ArcGIS pdf maps to a directory. I would >> like to include a step in the script where the pdf file is reduced in size >> instead of manually opening each file i