Re: My sys.excepthook dies painfully

2014-07-23 Thread Jason Swails
On Wed, Jul 23, 2014 at 6:30 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Wed, 23 Jul 2014 13:02:51 -0700, Jason Swails wrote: > > > I'm not sure how the "mylogger" variable is getting set to None in your > > my_error_handler callback, but I don't see how that can possib

Re: Question about asyncio doc example

2014-07-23 Thread Marko Rauhamaa
Saimadhav Heblikar : > For situations where I dont really know how long a function is going > to take(say waiting for user input or a network operation), I am > better off using callbacks than "yield from asyncio.sleep()". Is my > understanding correct? If you choose the coroutine style of progra

Re: My sys.excepthook dies painfully

2014-07-23 Thread Steven D'Aprano
On Thu, 24 Jul 2014 01:30:41 +, Steven D'Aprano wrote: > I wonder whether I ought to use atexit to register the function, rather > than mess with sys.excepthook directly? Ignore this. I was smoking crack. atexit has nothing to do with sys.excepthook and won't solve my problem. -- Steven -

Re: My sys.excepthook dies painfully

2014-07-23 Thread dieter
Steven D'Aprano writes: > I have some code which sets up a logger instance, then installs it as > sys.excepthook to capture any uncaught exceptions: > > > > import logging > import logging.handlers > import sys > > FACILITY = logging.handlers.SysLogHandler.LOG_LOCAL6 > mylogger = logging.getLogge

Re: Question about asyncio doc example

2014-07-23 Thread Saimadhav Heblikar
On 24 July 2014 05:54, Terry Reedy wrote: > On 7/23/2014 6:43 AM, Saimadhav Heblikar wrote: >> >> Hi, >> >> The example in question is >> >> https://docs.python.org/3/library/asyncio-task.html#example-hello-world-coroutine. >> I'd like to learn the purpose of the statement >> "yield from asyncio.s

Re: Question about Pass-by-object-reference?

2014-07-23 Thread Steven D'Aprano
On Thu, 24 Jul 2014 03:22:16 +, Steven D'Aprano wrote: [...] > I stated that "call function with argument x" and "pass x to function" > mean the same thing. Oh, a thought comes to mind. There is a sense in which "calling a function with argument x" is slightly different from "passing x to a

回复: how to download special range content with requests in python?

2014-07-23 Thread 水静流深
i want to write a multiple threads download program to practice my MT knowledge, 1)cut the big iso file into 20 parts 2)start 20 process with threading and queue module to download 3)combine the 20 parts into one iso file. if i have cut it into 20 parts ,how can i download the first part of it

Re: How to install data analysis pandas toolkit?

2014-07-23 Thread Miki Tebeka
Greetings, > >>> import pandas as pd > > No module named numpy I find the most painless way of installing the Python scientific stack is using Anaconda http://continuum.io/downloads HTH, -- Miki -- https://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to install Python on a network?

2014-07-23 Thread Dan Stromberg
On Wed, Jul 23, 2014 at 7:15 AM, roys2005 wrote: > > Dan, > > Thanks for the information. So, one option is to build Python > from source code to be able to install "/where/ever/..." > > I still wonder why there is no distribution package for *ix that > contains binaries/libraries that can

Re: 回复: how to download special range content with requests in python?

2014-07-23 Thread Chris Angelico
On Thu, Jul 24, 2014 at 1:21 PM, 水静流深 <1248283...@qq.com> wrote: > i want to write a multiple threads download program to practice my MT > knowledge, > 1)cut the big iso file into 20 parts > 2)start 20 process with threading and queue module to download > 3)combine the 20 parts into one iso file.

Re: Question about Pass-by-object-reference?

2014-07-23 Thread Steven D'Aprano
On Wed, 23 Jul 2014 18:51:47 -0400, Terry Reedy wrote: > On 7/23/2014 1:35 AM, Steven D'Aprano wrote: >> On Wed, 23 Jul 2014 11:59:45 +1000, Ben Finney wrote: >> >>> fl writes: >>> On Tuesday, July 22, 2014 8:27:15 PM UTC-4, Terry Reedy wrote: >>> The point being made is that no values are

Re: Is it possible to install Python on a network?

2014-07-23 Thread Chris Angelico
On Thu, Jul 24, 2014 at 12:48 PM, Ben Finney wrote: > Chris Angelico writes: > >> On Thu, Jul 24, 2014 at 12:35 PM, Ben Finney >> wrote: >> > What do you imaging a user doing, exactly, on machine ‘foo’ to make >> > a program execute on machine ‘bar’? At what step – exactly how – >> > does the c

Re: Is it possible to install Python on a network?

2014-07-23 Thread Ben Finney
Chris Angelico writes: > On Thu, Jul 24, 2014 at 12:35 PM, Ben Finney > wrote: > > What do you imaging a user doing, exactly, on machine ‘foo’ to make > > a program execute on machine ‘bar’? At what step – exactly how – > > does the communication between the machines occur to invoke the > > pro

Re: Is it possible to install Python on a network?

2014-07-23 Thread Chris Angelico
On Thu, Jul 24, 2014 at 12:35 PM, Ben Finney wrote: > roys2005 writes: > >> I am trying to find out how I can install Python on a central machine >> so that all users can use it > > That's what confuses me. How do you envisage this working? On a given > machine, you can *run* programs only on

Re: Is it possible to install Python on a network?

2014-07-23 Thread Ben Finney
roys2005 writes: > I am trying to find out how I can install Python on a central machine > so that all users can use it That's what confuses me. How do you envisage this working? On a given machine, you can *run* programs only on that machine. If you want to run a program on a different mac

Re: My sys.excepthook dies painfully

2014-07-23 Thread Chris Angelico
On Thu, Jul 24, 2014 at 11:30 AM, Steven D'Aprano wrote: > However, I think I have a glimmer of an idea for how the global variable > might be set to None. When the Python interpreter shuts down, it sets > global variables to None in some arbitrary order. If the excepthook > function isn't called

Re: My sys.excepthook dies painfully

2014-07-23 Thread Steven D'Aprano
On Wed, 23 Jul 2014 13:02:51 -0700, Jason Swails wrote: > I'm not sure how the "mylogger" variable is getting set to None in your > my_error_handler callback, but I don't see how that can possibly be > happening with the provided code... Dammit, it's a Heisenbug... now it's gone away for me too.

Re: OT: usenet reader software

2014-07-23 Thread Sturla Molden
Monte Milanuk wrote: > Aaaannnd here we have a good example of why it would be really nice to > be able to filter/score based on the message *body*, not just the > headers. 8( Actually, here we have the reason why Usenet died. -- https://mail.python.org/mailman/listinfo/python-list

Re: I want to do something with data

2014-07-23 Thread memilanuk
On 07/23/2014 03:20 PM, Nicholas Cannon wrote: Hey i am interested in using data in my programs. I know every program uses data but i want to do like large data processing and pick results out of a data like querying database. I dont really know what this is called though. Is it data analytics? i

Re: Distributing python applications as a zip file

2014-07-23 Thread Steven D'Aprano
On Wed, 23 Jul 2014 15:23:10 +0300, Burak Arslan wrote: > On 07/23/14 07:23, Steven D'Aprano wrote: >> A little known feature of Python: you can wrap your Python application >> in a zip file and distribute it as a single file. [...] > does it support package_data? or more specifically, does > pkg_

Re: How to install data analysis pandas toolkit?

2014-07-23 Thread fl
On Wednesday, July 23, 2014 8:30:00 PM UTC-4, fl wrote: I have figured it out. It is installed under Cygwin. Although there are some errors in the process, it works now. Thanks, -- https://mail.python.org/mailman/listinfo/python-list

How to install data analysis pandas toolkit?

2014-07-23 Thread fl
Hi, I download data analysis pandas toolkit (Windows 32 version) to my PC: pandas-0.14.0.win32-py2.7.exe After I run it, I still cannot import the module: >>> import pandas as pd No module named numpy Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\site-pack

Re: Question about asyncio doc example

2014-07-23 Thread Terry Reedy
On 7/23/2014 6:43 AM, Saimadhav Heblikar wrote: Hi, The example in question is https://docs.python.org/3/library/asyncio-task.html#example-hello-world-coroutine. I'd like to learn the purpose of the statement "yield from asyncio.sleep(2)" in that example. In particular, I'd like to know if asyn

Re: I want to do something with data

2014-07-23 Thread Mark Lawrence
On 23/07/2014 23:20, Nicholas Cannon wrote: Hey i am interested in using data in my programs. I know every program uses data but i want to do like large data processing and pick results out of a data like querying database. I dont really know what this is called though. Is it data analytics? i

Re: Is it possible to install Python on a network?

2014-07-23 Thread Ned Deily
In article <875ce0f0-c6a8-4b50-b97f-d11ee543e...@googlegroups.com>, roys2005 wrote: > I still wonder why there is no distribution package for *ix that > contains binaries/libraries that can be installed "/where/ever/..." One issue is that the Python build process on **ix captures the config

Re: Error in example in multiprocessing

2014-07-23 Thread Terry Reedy
On 7/23/2014 6:27 AM, Akshay Verma wrote: Example under 17.2.1.6. Using a pool of workers Has a error. As far as I understand, The input to res sleep function should be List and not integer. res =

Re: Question about Pass-by-object-reference?

2014-07-23 Thread Terry Reedy
On 7/23/2014 1:35 AM, Steven D'Aprano wrote: On Wed, 23 Jul 2014 11:59:45 +1000, Ben Finney wrote: fl writes: On Tuesday, July 22, 2014 8:27:15 PM UTC-4, Terry Reedy wrote: When you call a function, Python binds function parameter names to argument objects in the function's local namespace,

Re: Question about Pass-by-object-reference?

2014-07-23 Thread Terry Reedy
On 7/23/2014 1:36 AM, Steven D'Aprano wrote: On Tue, 22 Jul 2014 20:27:15 -0400, Terry Reedy wrote: When you call a function, Python binds function parameter names to argument objects in the function's local namespace, the same as in name assignments. Given def f(a, b): pass a call f(1, 'x')

I want to do something with data

2014-07-23 Thread Nicholas Cannon
Hey i am interested in using data in my programs. I know every program uses data but i want to do like large data processing and pick results out of a data like querying database. I dont really know what this is called though. Is it data analytics? im not sure but I would like to do this stuff.

Where is the function of Repr.repr1() in this example?

2014-07-23 Thread fl
Hi, I run the example code below from website: https://docs.python.org/2/library/repr.html#repr.Repr.repr1 If I run these lines from an editor, it echoes: >>> >>> dsfdsf # entered letters If I only run the last line (hoping the same effect with running from the editor) it simply ech

Using pyVmomi

2014-07-23 Thread Joseph L. Casale
I am doing some scripting with pyVmomi under 2.6.8 so the code may run directly on a vmware esxi server. As the code is long running, it surpasses the authentication timeout. For anyone familiar with this code and/or this style of programming, does anyone have a recommendation for an elegant authe

Re: My sys.excepthook dies painfully

2014-07-23 Thread Jason Swails
On Jul 23, 2014, at 1:02 AM, Chris Angelico wrote: > On Wed, Jul 23, 2014 at 5:46 PM, Steven D'Aprano wrote: >> On Wed, 23 Jul 2014 07:14:27 +, Steven D'Aprano wrote: >> >>> I have some code which sets up a logger instance, then installs it as >>> sys.excepthook to capture any uncaught exc

Re: Execution Time and Memory taken by the program

2014-07-23 Thread Irmen de Jong
On 23-7-2014 17:50, Orochi wrote: > I want a timer to calculate the execution time of the program > actually I am trying to solve problems on codechef.com and want to find out > the time and memory taken by the program to execute. > > I know we can import time.time() in unix and time.clock() in

Re: how to download special range content with requests in python?

2014-07-23 Thread Chris Angelico
On Wed, Jul 23, 2014 at 7:44 PM, 水静流深 <1248283...@qq.com> wrote: > url='http://debian.cites.illinois.edu/pub/debian-cd/7.6.0/amd64/iso-cd/debian-7.6.0-amd64-CD-1.iso' > import requests > r = requests.get(url).read(0,1000) ‍ > > why i can not download special range(from 0 to 1) content with re

Re: Is it possible to install Python on a network?

2014-07-23 Thread Chris Angelico
On Thu, Jul 24, 2014 at 12:24 AM, roys2005 wrote: > I am trying to find out how I can install Python on a central machine > so that all users can use it, rather than using /usr/local/bin/python. > ( I am talking about unix/linux platform ) > > Since, I do not know the answer, I was aski

Execution Time and Memory taken by the program

2014-07-23 Thread Orochi
I want a timer to calculate the execution time of the program actually I am trying to solve problems on codechef.com and want to find out the time and memory taken by the program to execute. I know we can import time.time() in unix and time.clock() in windows also there is a library timeit(). bu

Re: Is it possible to install Python on a network?

2014-07-23 Thread Chris Angelico
On Thu, Jul 24, 2014 at 12:15 AM, roys2005 wrote: > Thanks for the information. So, one option is to build Python > from source code to be able to install "/where/ever/..." > > I still wonder why there is no distribution package for *ix that > contains binaries/libraries that can be instal

Re: Network/multi-user program

2014-07-23 Thread Chris Angelico
On Thu, Jul 24, 2014 at 12:14 AM, memilanuk wrote: >> But more likely, what >> you really want is a cut-down UI that simplifies things: if the user >> is data-entry level, you take away all the admin-type options. It >> might be possible to fiddle around in internals and gain elevated >> access, b

Re: Is it possible to install Python on a network?

2014-07-23 Thread roys2005
Ben, I am trying to find out how I can install Python on a central machine so that all users can use it, rather than using /usr/local/bin/python. ( I am talking about unix/linux platform ) Since, I do not know the answer, I was asking if Python can/can't/should/shouldn't be installed

Re: Is it possible to install Python on a network?

2014-07-23 Thread roys2005
Dan, Thanks for the information. So, one option is to build Python from source code to be able to install "/where/ever/..." I still wonder why there is no distribution package for *ix that contains binaries/libraries that can be installed "/where/ever/..." Or, may be there is - I just

Re: Network/multi-user program

2014-07-23 Thread memilanuk
On 07/21/2014 11:26 AM, Chris Angelico wrote: On Tue, Jul 22, 2014 at 4:16 AM, Monte Milanuk wrote: On 2014-07-21, Chris Angelico wrote: On Tue, Jul 22, 2014 at 2:07 AM, Monte Milanuk wrote: So I guess I'm asking for advice or simplified examples of how to go about connecting a client deskt

Re: Automating windows media player on win7

2014-07-23 Thread MRAB
On 2014-07-23 12:55, Deogratius Musiige wrote: Hi, I have the mentioned imports. And for the matter of fact I can play the audio. The problem is when I make a class with the wmplayer automating code and make an instance of this class in my testing code. When I run this instance, I do not get a

Re: how to download special range content with requests in python?

2014-07-23 Thread Joel Goldstick
On Wed, Jul 23, 2014 at 9:03 AM, Joel Goldstick wrote: > > > > > On Wed, Jul 23, 2014 at 5:44 AM, 水静流深 <1248283...@qq.com> wrote: >> >> url='http://debian.cites.illinois.edu/pub/debian-cd/7.6.0/amd64/iso-cd/debian-7.6.0-amd64-CD-1.iso' >> import requests >> r = requests.get(url).read(0,1000) ‍ >>

Re: how to download special range content with requests in python?

2014-07-23 Thread Joel Goldstick
On Wed, Jul 23, 2014 at 5:44 AM, 水静流深 <1248283...@qq.com> wrote: > url=' > http://debian.cites.illinois.edu/pub/debian-cd/7.6.0/amd64/iso-cd/debian-7.6.0-amd64-CD-1.iso > ' > import requests > r = requests.get(url).read(0,1000) ‍ > > why i can not download special range(from 0 to 1) content

Error in example in multiprocessing

2014-07-23 Thread Akshay Verma
Example under 17.2.1.6. Using a pool of workers Has a error. As far as I understand, The input to res sleep function should be List and not integer. res = pool.apply_async(sleep, 10) Let me know if I am wrong. Be

how to download special range content with requests in python?

2014-07-23 Thread 水静流深
url='http://debian.cites.illinois.edu/pub/debian-cd/7.6.0/amd64/iso-cd/debian-7.6.0-amd64-CD-1.iso' import requests r = requests.get(url).read(0,1000) ‍ why i can not download special range(from 0 to 1) content with requests in python‍?-- https://mail.python.org/mailman/listinfo/python-

Re: Distributing python applications as a zip file

2014-07-23 Thread Burak Arslan
On 07/23/14 07:23, Steven D'Aprano wrote: > A little known feature of Python: you can wrap your Python application in > a zip file and distribute it as a single file. The trick to make it > runnable is to put your main function inside a file called __main__.py > inside the zip file. Here's a ba

RE: Automating windows media player on win7

2014-07-23 Thread Deogratius Musiige
Hi, I have the mentioned imports. And for the matter of fact I can play the audio. The problem is when I make a class with the wmplayer automating code and make an instance of this class in my testing code. When I run this instance, I do not get any audio out? Best regards / Med venlig hilsen

Re: What is a nit(sp?) function.

2014-07-23 Thread MRAB
On 2014-07-23 10:43, Antoon Pardon wrote: I have been looking at some python talks on you tube: https://www.youtube.com/watch?v=o9pEzgHorH0 and https://www.youtube.com/watch?v=sPiWg5jSoZI And these two both mentioned nits or nit functions or something like that. I tried to google it but came

Re: Question about asyncio doc example

2014-07-23 Thread Yaşar Arabacı
asyncio.sleep() returns you a Future. When you yield from a future, your coroutine blocks, until the Future completes. In the meantime, event loop continutes to execute other things that are waiting to be executed. The Future returned from asyncio.sleep gets completed after specified seconds. 2014

Re: Automating windows media player on win7

2014-07-23 Thread MRAB
On 2014-07-23 10:20, Deogratius Musiige wrote: Hi mate, The fix you provided works perfect. However, if I put it in a class and import, make instance and execute in another file, the audio is not played. What am I missing? This is what I do: I'm assuming that you're not actually calling th

Question about asyncio doc example

2014-07-23 Thread Saimadhav Heblikar
Hi, The example in question is https://docs.python.org/3/library/asyncio-task.html#example-hello-world-coroutine. I'd like to learn the purpose of the statement "yield from asyncio.sleep(2)" in that example. In particular, I'd like to know if asyncio.sleep() is used as a substitute for slow/time

Re: What is a nit(sp?) function.

2014-07-23 Thread Peter Otten
Antoon Pardon wrote: > I have been looking at some python talks on you tube: > > https://www.youtube.com/watch?v=o9pEzgHorH0 > > and > > https://www.youtube.com/watch?v=sPiWg5jSoZI > > And these two both mentioned nits or nit functions or something > like that. I tried to google it but came up

Re: What is a nit(sp?) function.

2014-07-23 Thread Chris Angelico
On Wed, Jul 23, 2014 at 7:43 PM, Antoon Pardon wrote: > I have been looking at some python talks on you tube: > > https://www.youtube.com/watch?v=o9pEzgHorH0 > > and > > https://www.youtube.com/watch?v=sPiWg5jSoZI > > And these two both mentioned nits or nit functions or something > like that. I t

RE: Automating windows media player on win7

2014-07-23 Thread Deogratius Musiige
Hi mate, The fix you provided works perfect. However, if I put it in a class and import, make instance and execute in another file, the audio is not played. What am I missing? This is what I do: FileA.py class WMPlayer(): ''' @ ''' #static var #first instance is a primar

What is a nit(sp?) function.

2014-07-23 Thread Antoon Pardon
I have been looking at some python talks on you tube: https://www.youtube.com/watch?v=o9pEzgHorH0 and https://www.youtube.com/watch?v=sPiWg5jSoZI And these two both mentioned nits or nit functions or something like that. I tried to google it but came up empty. Anyone an idea what they are talk

Re: Distributing python applications as a zip file

2014-07-23 Thread Leo Jay
On Wed, Jul 23, 2014 at 12:23 PM, Steven D'Aprano wrote: > A little known feature of Python: you can wrap your Python application in > a zip file and distribute it as a single file. The trick to make it > runnable is to put your main function inside a file called __main__.py > inside the zip file.

Re: Distributing python applications as a zip file

2014-07-23 Thread Thomas Heller
Am 23.07.2014 06:23, schrieb Steven D'Aprano: A little known feature of Python: you can wrap your Python application in a zip file and distribute it as a single file. The trick to make it runnable is to put your main function inside a file called __main__.py inside the zip file. Look here: htt

Re: My sys.excepthook dies painfully

2014-07-23 Thread Chris Angelico
On Wed, Jul 23, 2014 at 5:46 PM, Steven D'Aprano wrote: > On Wed, 23 Jul 2014 07:14:27 +, Steven D'Aprano wrote: > >> I have some code which sets up a logger instance, then installs it as >> sys.excepthook to capture any uncaught exceptions: > > Oh! I should have said, I'm running Python 2.6.

Re: Distributing python applications as a zip file

2014-07-23 Thread Chris Angelico
On Wed, Jul 23, 2014 at 2:23 PM, Steven D'Aprano wrote: > On Linux, you can even hack the zip file to include a shebang line! > > > steve@runes:~$ cat appl > #!/usr/bin/env python > # This is a Python application stored in a ZIP archive. > steve@runes:~$ cat appl.zip >> appl > steve@runes:~$ chmod

Re: My sys.excepthook dies painfully

2014-07-23 Thread Steven D'Aprano
On Wed, 23 Jul 2014 07:14:27 +, Steven D'Aprano wrote: > I have some code which sets up a logger instance, then installs it as > sys.excepthook to capture any uncaught exceptions: Oh! I should have said, I'm running Python 2.6. -- Steven -- https://mail.python.org/mailman/listinfo/python

Re: My sys.excepthook dies painfully

2014-07-23 Thread Chris Angelico
On Wed, Jul 23, 2014 at 5:14 PM, Steven D'Aprano wrote: > Error in sys.excepthook: > Traceback (most recent call last): > File "/home/steve/mylogging.py", line 28, in my_error_handler > mylogger.exception(msg) > AttributeError: 'NoneType' object has no attribute 'exception' > > Original exce

Re: Distributing python applications as a zip file

2014-07-23 Thread Tim Golden
On 23/07/2014 06:30, Gary Herron wrote: > On 07/22/2014 09:23 PM, Steven D'Aprano wrote: >> A little known feature of Python: you can wrap your Python application in >> a zip file and distribute it as a single file. > Really! 20 years of Pythoning, and I'd never seen this! When was this > intr

My sys.excepthook dies painfully

2014-07-23 Thread Steven D'Aprano
I have some code which sets up a logger instance, then installs it as sys.excepthook to capture any uncaught exceptions: import logging import logging.handlers import sys FACILITY = logging.handlers.SysLogHandler.LOG_LOCAL6 mylogger = logging.getLogger('spam') handler = logging.handlers.SysLog