Re: True == 1 weirdness

2015-09-18 Thread Jussi Piitulainen
Random832 writes: > On Fri, Sep 18, 2015, at 14:24, Terry Reedy wrote: >> If a, b, c are members of a totally ordered set, so that < is >> transitive, this is equivalent to max(a,c) < b. But the latter makes >> an irrelevant comparison between a and c. > > But *who would write that?* It's not a n

ConnectionError handling problem

2015-09-18 Thread shiva upreti
I am learning python. I wrote a script using requests module. The scripts runs fine for sometime, but after a while it hangs. When I press CTRL+C it shows ConnectionError even though I have included exception handling. I am not sure as to why it cant handle ConnectionError when the script runs for

Re: Shutting down a cross-platform multithreaded app

2015-09-18 Thread Akira Li
"James Harris" writes: ... > Needless to say, on a test Windows machine AF_UNIX is not present. The > only cross-platform option, therefore, seems to be to use each > subthread's select()s to monitor two AF_INET sockets: the one to the > client and a control one from the master thread. I would se

Re: Shutting down a cross-platform multithreaded app

2015-09-18 Thread Chris Angelico
On Sat, Sep 19, 2015 at 7:48 AM, Random832 wrote: > On Fri, Sep 18, 2015, at 17:40, Chris Angelico wrote: >> Bear in mind, though, that Windows has no protection against other >> processes shutting you down. > > Neither does Unix. Any process that can send you a signal can send you > SIGKILL. Inc

Re: Shutting down a cross-platform multithreaded app

2015-09-18 Thread Random832
On Fri, Sep 18, 2015, at 17:40, Chris Angelico wrote: > Bear in mind, though, that Windows has no protection against other > processes shutting you down. Neither does Unix. Any process that can send you a signal can send you SIGKILL. Of course, what Windows lacks is a generalized way for other pr

Re: Writing a module to abstract a REST api

2015-09-18 Thread Joseph L. Casale
Hi Sven, >> The problem now comes from the following: >> >> # foo now contains a handle to the remote api. >> foo = InstanceOfApiWrapper() > > Is it necessary to have an instance of that API? Just curiosity here. Not always but often as the pattern here might rely on a handle to a c types based a

Re: Shutting down a cross-platform multithreaded app

2015-09-18 Thread Chris Angelico
On Sat, Sep 19, 2015 at 3:17 AM, James Harris wrote: > Needless to say, on a test Windows machine AF_UNIX is not present. The only > cross-platform option, therefore, seems to be to use each subthread's > select()s to monitor two AF_INET sockets: the one to the client and a > control one from the

Re: True == 1 weirdness

2015-09-18 Thread Random832
On Fri, Sep 18, 2015, at 17:13, Ian Kelly wrote: > Whoever wrote the Wikipedia article disagrees: > > https://en.wikipedia.org/wiki/Inequality_(mathematics)#Chained_notation > > Although the reference to Python leads one to suspect that this could > be based more on Python's semantics than on act

Re: True == 1 weirdness

2015-09-18 Thread Ian Kelly
On Fri, Sep 18, 2015 at 1:12 PM, Random832 wrote: > On Fri, Sep 18, 2015, at 14:24, Terry Reedy wrote: >> The semantics Python copies from math is "a op b op c == a op b and b op >> c", > > I don't believe those *are* the semantics in math. I believe that in > math this notation is *specifically*

Re: Shutting down a cross-platform multithreaded app

2015-09-18 Thread Laura Creighton
In a message of Fri, 18 Sep 2015 20:09:19 +0100, "James Harris" writes: >> Set the daemon flag on the worker threads, so when the main thread >> exits, the workers also exit. > >Interesting idea, and I did not know that a *thread* could be a daemon. >Unfortunately, I think what you suggest would k

Re: Shutting down a cross-platform multithreaded app

2015-09-18 Thread Marko Rauhamaa
"James Harris" : > I have a multithreaded app that I want to be able to shut down easily > such as by hitting control-c or sending it a signal. The problem with threads is you cannot cause them to exit from the outside. You can do that to asyncio coroutines, however. Maybe you should consider por

Conda problem/question

2015-09-18 Thread Skip Montanaro
I was following along with Lex Hider's PyCon Au talk about Conda: https://www.youtube.com/watch?v=Fqknoni5aX0 Everything was going swimmingly. I installed miniconda, tweaked PATH, installed some of the other stuff he talked about, then did the pip command: pip install theano keras tweepy word2ve

Catching exceptions from logging socket handler

2015-09-18 Thread Larry Martell
I have a socket logging handler and I want to be able to catch exceptions from it. Specifically, I want to know if the remote side has gone away so I can close the socket and reopen it when the remote side come back. What happens now is that I get Broken pipe and BAD_WRITE_RETRY exceptions, but it

Re: True == 1 weirdness

2015-09-18 Thread Random832
On Fri, Sep 18, 2015, at 14:24, Terry Reedy wrote: > If a, b, c are members of a totally ordered set, so that < is > transitive, this is equivalent to max(a,c) < b. But the latter makes an > irrelevant comparison between a and c. But *who would write that?* It's not a natural form of notation.

Re: Shutting down a cross-platform multithreaded app

2015-09-18 Thread James Harris
"Paul Rubin" wrote in message news:87zj0jd1ta@jester.gateway.sonic.net... "James Harris" writes: I have a multithreaded app that I want to be able to shut down easily such as by hitting control-c or sending it a signal. Set the daemon flag on the worker threads, so when the main thre

Re: True == 1 weirdness

2015-09-18 Thread Terry Reedy
On 9/18/2015 9:40 AM, Random832 wrote: I'm disputing that chained comparisons are used for the particular combinations that I am actually arguing should not be used in python. You are free to dislike certain combinations, not use them yourself, and even request others not to use them (all in

Re: Shutting down a cross-platform multithreaded app

2015-09-18 Thread Paul Rubin
"James Harris" writes: > I have a multithreaded app that I want to be able to shut down easily > such as by hitting control-c or sending it a signal. Set the daemon flag on the worker threads, so when the main thread exits, the workers also exit. -- https://mail.python.org/mailman/listinfo/pyt

Re: Writing a module to abstract a REST api

2015-09-18 Thread Sven R. Kunze
On 18.09.2015 17:28, Joseph L. Casale wrote: So a design pattern I use often is to create Python objects to represent objects returned from what ever api I am abstracting. For example I might create named tuples for static data I dont intend to change or for an object I can both query for and cre

Shutting down a cross-platform multithreaded app

2015-09-18 Thread James Harris
Well, this is fun ... for some definition of the word. ;-( I have a multithreaded app that I want to be able to shut down easily such as by hitting control-c or sending it a signal. What follows is the way I have come up with given the common elements of different environments. Suggestions for

Elektra 0.8.13 with python plugins

2015-09-18 Thread Markus Raab
Hello everyone, ## Python Plugins A technical preview of [python3] (http://git.libelektra.org/blob/master/src/plugins/python) and [python2](http://git.libelektra.org/blob/master/src/plugins/python2) plugins has been added. With them its possible to write any plugin, not only applications, with

Re: Writing a module to abstract a REST api

2015-09-18 Thread Joseph L. Casale
> Well, I would be interested in seeing such a module as well. > > Most modules and frameworks, I know, providing REST and interacting with > REST are more like traditional SOAP-like web services. You got your > functions which have a 1-to-1 correspondence with some resource URLs and > that's it.

Re: Automating build from source (was: Automating Sphinx generated documentation)

2015-09-18 Thread Grant Edwards
On 2015-09-18, John Wong wrote: > if you are okay with cloning a huge repository then I don't see a problem. Ah yes, if the repository got cloned a lot that would be a problem. The repository in question doesn't get cloned (it does get backed up). As I mentioned, it's subversion. Subversion is

Re: Automating build from source (was: Automating Sphinx generated documentation)

2015-09-18 Thread John Wong
On Fri, Sep 18, 2015 at 2:50 AM, Peter Otten <__pete...@web.de> wrote: > Ben Finney wrote: > > > David Aldrich writes: > > > >> I have setup Sphinx for my Python project. We keep all our code and > >> documentation in Subversion. > > > > It's a good idea to keep *source* files in VCS. > > > > The

Re: Pyarmor, guard your python scripts

2015-09-18 Thread Jondy Zhao
On Friday, September 18, 2015 at 9:08:27 PM UTC+8, Lorenzo Sutton wrote: > On 18/09/2015 13:41, Jondy Zhao wrote: > [...] > > In reality, when we leave the house, we lock the door, even the lock could > > not make sure the safe of our property. It's just make it difficult. > > It's same in the soft

Re: .bat file trouble.

2015-09-18 Thread Christian Gollwitzer
Am 18.09.15 um 11:06 schrieb bobert...@googlemail.com: Hi, I have two files called module_scripts.py and build_q_scripts.bat. The problem being that when I go to run the bat file it produces a few errors which neither myself or the original owner of the files could understand. Errors: https:/

Re: True == 1 weirdness

2015-09-18 Thread Random832
On Fri, Sep 18, 2015, at 09:14, Steven D'Aprano wrote: > On Fri, 18 Sep 2015 10:47 pm, Random832 wrote: > > > On Fri, Sep 18, 2015, at 08:30, Steven D'Aprano wrote: > >> On Fri, 18 Sep 2015 07:26 am, Random832 wrote: > >> > >> > I don't even think chaining should > >> > work for all *actual* comp

Re: True == 1 weirdness

2015-09-18 Thread Steven D'Aprano
On Fri, 18 Sep 2015 10:47 pm, Random832 wrote: > On Fri, Sep 18, 2015, at 08:30, Steven D'Aprano wrote: >> On Fri, 18 Sep 2015 07:26 am, Random832 wrote: >> >> > I don't even think chaining should >> > work for all *actual* comparison operations. >> >> I don't see why. Mathematicians chain compa

Re: Pyarmor, guard your python scripts

2015-09-18 Thread Lorenzo Sutton
On 18/09/2015 13:41, Jondy Zhao wrote: [...] In reality, when we leave the house, we lock the door, even the lock could not make sure the safe of our property. It's just make it difficult. It's same in the software world. Someone need the lock in both of the world. I think you meant "in the *pr

Re: True == 1 weirdness

2015-09-18 Thread Random832
On Fri, Sep 18, 2015, at 08:30, Steven D'Aprano wrote: > On Fri, 18 Sep 2015 07:26 am, Random832 wrote: > > > I don't even think chaining should > > work for all *actual* comparison operations. > > I don't see why. Mathematicians chain comparisons all the time. If the > language implements the sa

Re: True == 1 weirdness

2015-09-18 Thread Steven D'Aprano
On Fri, 18 Sep 2015 07:26 am, Random832 wrote: > I don't even think chaining should > work for all *actual* comparison operations. I don't see why. Mathematicians chain comparisons all the time. If the language implements the same semantics as mathematicians already use, why do you dislike that?

Re: Pyarmor, guard your python scripts

2015-09-18 Thread Ben Finney
Jondy Zhao writes: > In reality, when we leave the house, we lock the door, even the lock > could not make sure the safe of our property. It's just make it > difficult. It's same in the software world. Someone need the lock in > both of the world. Yes, please don't encourage authors to put locks

Re: Pyarmor, guard your python scripts

2015-09-18 Thread Jondy Zhao
On Friday, September 18, 2015 at 6:06:51 PM UTC+8, alister wrote: > On Fri, 18 Sep 2015 01:31:50 -0700, Jondy Zhao wrote: > > > On Friday, September 18, 2015 at 4:08:57 PM UTC+8, alister wrote: > >> On Thu, 17 Sep 2015 22:38:32 -0700, Jondy Zhao wrote: > >> > >> > On Friday, September 18, 2015 at

Re: Pyarmor, guard your python scripts

2015-09-18 Thread alister
On Fri, 18 Sep 2015 01:31:50 -0700, Jondy Zhao wrote: > On Friday, September 18, 2015 at 4:08:57 PM UTC+8, alister wrote: >> On Thu, 17 Sep 2015 22:38:32 -0700, Jondy Zhao wrote: >> >> > On Friday, September 18, 2015 at 1:02:09 PM UTC+8, Chris Angelico >> > wrote: >> >> On Fri, Sep 18, 2015 at 12

Re: Einstein's Riddle

2015-09-18 Thread Nick Sarbicki
On Fri, Sep 18, 2015 at 10:33 AM, Steven D'Aprano wrote: > On Fri, 18 Sep 2015 04:44 am, Ian Kelly wrote: > > > On Thu, Sep 17, 2015 at 3:19 AM, wrote: > >> This is not true that only two percent of this world can solve this > >> puzzle. May be the 2% will solve it by a quick look on the statem

Re: Einstein's Riddle

2015-09-18 Thread Steven D'Aprano
On Fri, 18 Sep 2015 04:44 am, Ian Kelly wrote: > On Thu, Sep 17, 2015 at 3:19 AM, wrote: >> This is not true that only two percent of this world can solve this >> puzzle. May be the 2% will solve it by a quick look on the statements. > > Are you replying to this thread? > > https://mail.python

Re: .bat file trouble.

2015-09-18 Thread Steven D'Aprano
On Fri, 18 Sep 2015 07:06 pm, bobert...@googlemail.com wrote: > Hi, > > I have two files called module_scripts.py and build_q_scripts.bat. > > The problem being that when I go to run the bat file it produces a few > errors which neither myself or the original owner of the files could > understan

.bat file trouble.

2015-09-18 Thread bobertini--- via Python-list
Hi, I have two files called module_scripts.py and build_q_scripts.bat. The problem being that when I go to run the bat file it produces a few errors which neither myself or the original owner of the files could understand. Errors: https://gyazo.com/c680f0d70cefe855c21ab0882d7c17b7 We original

Re: Pyarmor, guard your python scripts

2015-09-18 Thread Jondy Zhao
On Friday, September 18, 2015 at 4:08:57 PM UTC+8, alister wrote: > On Thu, 17 Sep 2015 22:38:32 -0700, Jondy Zhao wrote: > > > On Friday, September 18, 2015 at 1:02:09 PM UTC+8, Chris Angelico wrote: > >> On Fri, Sep 18, 2015 at 12:40 PM, Jondy Zhao > >> wrote: > >> > The loader only can see the

Re: Pyarmor, guard your python scripts

2015-09-18 Thread Chris Angelico
On Fri, Sep 18, 2015 at 6:05 PM, Jondy Zhao wrote: > I know you hate it. But I have purchased some commercial software in this way > before, a tool named ERWIN used to create relation database. The license I > got from software provider is bind to the network card of my PC. I can't use > this t

Re: Pyarmor, guard your python scripts

2015-09-18 Thread alister
On Thu, 17 Sep 2015 22:38:32 -0700, Jondy Zhao wrote: > On Friday, September 18, 2015 at 1:02:09 PM UTC+8, Chris Angelico wrote: >> On Fri, Sep 18, 2015 at 12:40 PM, Jondy Zhao >> wrote: >> > The loader only can see the compiled scripts as ast nodes, even if >> > the load some tools could dump th

Re: Pyarmor, guard your python scripts

2015-09-18 Thread Jondy Zhao
On Friday, September 18, 2015 at 3:27:28 PM UTC+8, Chris Angelico wrote: > On Fri, Sep 18, 2015 at 3:55 PM, Jondy Zhao wrote: > > On Friday, September 18, 2015 at 11:06:25 AM UTC+8, Ben Finney wrote: > >> Jondy Zhao writes: > >> > >> > For example, I develop a game by python. What I want to do is

Re: Pyarmor, guard your python scripts

2015-09-18 Thread Chris Angelico
On Fri, Sep 18, 2015 at 3:55 PM, Jondy Zhao wrote: > On Friday, September 18, 2015 at 11:06:25 AM UTC+8, Ben Finney wrote: >> Jondy Zhao writes: >> >> > For example, I develop a game by python. What I want to do is that the >> > player or the agent could not simply copy the game to others. For th

Re: True == 1 weirdness

2015-09-18 Thread Jussi Piitulainen
Random832 writes: > On Thu, Sep 17, 2015, at 16:24, Jussi Piitulainen wrote: >> And I'm saying 'in', being truth-valued, is more like a comparison >> than a proper binary operation that has its value in the same set as >> its two arguments. > > The problem is that except for very specialized cases