Need help w 'Broken pipe' handling

2010-02-03 Thread gb345
Hi! I'm having a hard time figuring out how to handle a Unix SIGPIPE exception cleanly. The following short script illustrates the problem: -- #!/usr/bin/python # sigpipebug.py import sys import random from signal import signal,

Re: simple and fast platform independent IPC

2010-02-03 Thread News123
Hi Terry, Terry Reedy wrote: > > That aside, I would wonder whether you could use a master process with a > gui to haphazardly launch subprocess, so as to avail oneself of > multiprocessing.Queue. > T This is also an option I'm looking. insted of the python scripts, thet users would normally

Re: Dreaming of new generation IDE

2010-02-03 Thread Paul Rubin
Steven D'Aprano writes: >> and recompile your codebase. Every place in the code that called >> 'method' now gets a compile time "undefined method" error that you can >> examine to see if you need to update it. This is something you can't >> catch with unit tests because the call sites can be in

Re: Passing parameters in URL

2010-02-03 Thread Diez B. Roggisch
Am 03.02.10 19:01, schrieb Alan Harris-Reid: I have a web-page where each row in a grid has edit/delete buttons to enable the user to maintain a selected record on another page. The buttons are in the form of a link with href='/item_edit?id=123', but this string appears in the URL and gives clues

[Off topic] Radian language

2010-02-03 Thread Steven D'Aprano
For those interested in language design, the former head of RealBasic's development team, and current "compiler architect guy" for Microsoft's VisualBasic team, Mars Saxman, is developing an interesting programming language, Radian: "The goal of the Radian project is to provide the concurrency

Re: PyChecker under python's virtualenv

2010-02-03 Thread Diez B. Roggisch
Am 03.02.10 22:46, schrieb soltys: Hi Everybody, I've been doing some test on pythons' virtualenv and recently I've decided to run PyChecker. But I'm having some difficulties with importing modules available only on virtualenv by pychecker. As if it was trying to use systemwide python. I've googl

Re: Dreaming of new generation IDE

2010-02-03 Thread John Bokma
Vladimir Ignatov writes: >> I guess Vladimir means what's called a structure editor. The (by me) >> aforementioned Synthesizer Generator is an example of such an editor >> (environment). > > Maybe. Yes, it kind of "generator". It has (entered somehow) internal > representation of target program.

Re: How to guard against bugs like this one?

2010-02-03 Thread Carl Banks
On Feb 3, 8:55 am, Nobody wrote: > On Tue, 02 Feb 2010 10:38:53 -0800, Carl Banks wrote: > >> I don't know if that's necessary. Only supporting the "foo.h" case would > >> work fine if Python behaved like gcc, i.e. if the "current directory" > >> referred to the directory contain the file performi

Re: Dreaming of new generation IDE

2010-02-03 Thread Terry Reedy
On 2/3/2010 8:18 AM, Adam Tauno Williams wrote: class.method(sting name, int count) - is *obviously* more expressive than - class.method(name, count) So write class.method(name:str, count:int)->return_type # 3.x if you really prefer. In spite of you disparagement of 'pythonistas', it seem

Re: Dreaming of new generation IDE

2010-02-03 Thread Robert Kern
On 2010-02-03 15:40 PM, Steven D'Aprano wrote: On Wed, 03 Feb 2010 06:42:52 -0800, Paul Rubin wrote: One nice trick with static types is if you change what the method does (even if its type signature doesn't change), you can rename the method: class.method2(string name, int count): # chan

Re: PEP 3147 - new .pyc format

2010-02-03 Thread Daniel Fetchinson
>>> Python does most of that for you: it automatically recompiles the >>> source whenever the source code's last modified date stamp is newer >>> than that of the byte code. So to a first approximation you can forget >>> all about the .pyc files and just care about the source. >> >> True, but the .

Re: How to guard against bugs like this one?

2010-02-03 Thread Carl Banks
On Feb 2, 8:52 pm, Steven D'Aprano wrote: > On Tue, 02 Feb 2010 19:55:15 -0800, Carl Banks wrote: > > On Feb 2, 5:49 pm, Steven D'Aprano > > wrote: > >> On Tue, 02 Feb 2010 12:26:16 -0800, Carl Banks wrote: > >> > I did not propose obvious module names.  I said obvious names like > >> > email.py

Re: Dreaming of new generation IDE

2010-02-03 Thread Robert Kern
On 2010-02-03 15:37 PM, Steven D'Aprano wrote: On Wed, 03 Feb 2010 08:18:40 -0500, Adam Tauno Williams wrote: On Wed, 2010-02-03 at 14:10 +0300, Vladimir Ignatov wrote: Hello, I am sitting here for quite some time, but usually keep silent ;-) I use Python since 2003 both "professionally" and f

Re: Passing parameters in URL

2010-02-03 Thread Paul Rubin
"Diez B. Roggisch" writes: > If somebody happens to have access to a proxy & it's logs, he can as > well log the request body. I'm not talking about a malicious server operator. In this situation, I was the server operator and I didn't want to be recording the conversations. I had to go out of

equivalent of Ruby's Pathname?

2010-02-03 Thread Phlip
Pythonistas: Yes, calling os.path.walk() and os.path.join() all the time on raw strings is fun, but I seem to recall from my Ruby days a class called Pathname, which presented an object that behaved like a string at need, and like a filesystem path at need. path + 'folder' would call .join() and i

Re: Python and Ruby

2010-02-03 Thread Lou Pecora
In article <1944d953-25ad-440b-9317-a7a4b4de6...@f17g2000prh.googlegroups.com>, Jonathan Gardner wrote: > > I can explain all of Python in an hour; I doubt anyone will understand > all of Python in an hour. > > Coming from perl to python, the big "aha!" moment was when I realized > there wasn

mouse input in turtle module

2010-02-03 Thread Brian Blais
Hello, I would like to find a way to pause, and get mouse input in the turtle module. Since it is built on tk, I thought perhaps there would be an easy way, but I am stumped. Specifically, I'd like something like: x,y,button=mouse_input() # pause in here until the mouse is clicked in

Re: Python and Ruby

2010-02-03 Thread John Bokma
Jonathan Gardner writes: > On Feb 2, 9:11 pm, John Bokma wrote: >> Jonathan Gardner writes: >> > I can explain, in an hour, every single feature of the Python language >> > to an experienced programmer, all the way up to metaclasses, >> >> Either you're a hell of a talker, or I am far, far away

Re: Python and Ruby

2010-02-03 Thread Paul Rubin
Lou Pecora writes: > after much noodling around and reading it hit me that I could just put > all that output of different types of variables into a list, hit it > with a repr() function to get a string version, and write the string > to a file -- no formatting necessary-- three lines of code. Lat

Re: Passing parameters in URL

2010-02-03 Thread Diez B. Roggisch
Am 03.02.10 23:35, schrieb Paul Rubin: "Diez B. Roggisch" writes: If somebody happens to have access to a proxy& it's logs, he can as well log the request body. I'm not talking about a malicious server operator. In this situation, I was the server operator and I didn't want to be recording

Re: Selenium/SauceLabs OpenSpace at Pycon

2010-02-03 Thread Terry Reedy
On 2/3/2010 1:42 PM, Raymond Hettinger wrote: For those who are interested, the Sauce Labs team, http://saucelabs.com/about/team, is hosting two free tutorial open space sessions at Pycon in Atlanta. In the short session, people bringing their laptops should be able to record a web session in t

Re: Python and Ruby

2010-02-03 Thread Steve Holden
Robert Kern wrote: > On 2010-02-03 15:32 PM, Jonathan Gardner wrote: > >> I can explain all of Python in an hour; I doubt anyone will understand >> all of Python in an hour. > > With all respect, talking about a subject without a reasonable chance of > your audience understanding the subject afte

Re: Passing parameters in URL

2010-02-03 Thread Paul Rubin
"Diez B. Roggisch" writes: > Of course only information not gathered is really safe > information. But every operation that has side-effects is reproducable > anyway, and if e.g. your chat-app has a history, you can as well log > the parameters. No I can't. The chat-app history would be on the c

Re: expy 0.5.2 released

2010-02-03 Thread Yingjie Lan
> > > > expy is an expressway to extend python. > > > > in release 0.5.2, expy now supports custom exceptions, > besides all built-in ones, and exception handling is made > easy. > > > > for more info, see > > > > http://expy.sourceforge.net/ > > What Python versions does it work with? > There is

Re: Dreaming of new generation IDE

2010-02-03 Thread Steven D'Aprano
On Wed, 03 Feb 2010 16:38:21 -0600, Robert Kern wrote: >>> class.method(name, count) >> >> Obviously? I don't know about that. Being told that "count" is an int >> doesn't really help me -- it's obvious just from the name. In a well- >> written API, what else could it be? > > A bool. As in tellin

pychecker and "import my.special.module as mymod"

2010-02-03 Thread News123
Hi, I'm not really used to structuring modules withn directories, but I started playing # # the commands to reproduce my setup: # mkdir -p my/special touch my/__init__.py my/special/__init__.py echo 'print "myspecialmod"' >

Python 3 minor irritation

2010-02-03 Thread David Monaghan
I have a small program which reads files from the directory in which it resides. It's written in Python 3 and when run through IDLE or PythonWin works fine. If I double-click the file, it works fine in Python 2.6, but in 3 it fails because it looks for the files to load in the Python31 folder, not

Re: Dreaming of new generation IDE

2010-02-03 Thread Robert Kern
On 2010-02-03 18:01 PM, Steven D'Aprano wrote: On Wed, 03 Feb 2010 16:38:21 -0600, Robert Kern wrote: class.method(name, count) Obviously? I don't know about that. Being told that "count" is an int doesn't really help me -- it's obvious just from the name. In a well- written API, what else co

Re: PyChecker under python's virtualenv

2010-02-03 Thread Steve Holden
Diez B. Roggisch wrote: > Am 03.02.10 22:46, schrieb soltys: >> Hi Everybody, >> I've been doing some test on pythons' virtualenv and recently I've >> decided to run PyChecker. But I'm having some difficulties with importing >> modules available only on virtualenv by pychecker. As if it was >> tryi

YAML (was: Python and Ruby)

2010-02-03 Thread John Bokma
Lou Pecora writes: > That's a pretty accurate description of how I transitioned to Python > from C and Fortran. Not C, but C++ (but there are also C implementations): YAML, see: http://code.google.com/p/yaml-cpp/wiki/HowToParseADocument I use YAML now and then with Perl for both reading/writin

Re: Dreaming of new generation IDE

2010-02-03 Thread Steve Holden
Vladimir Ignatov wrote: >> can you sketch an example/use case more concretely? > > Sorry, I don't have anything written down. I just have some rough idea > of implementation and some concrete features I would like to see in > such system. For example: > > 1) Instant refactoring. No more needs fo

Re: Dreaming of new generation IDE

2010-02-03 Thread alex23
Adam Tauno Williams wrote: > This is obvious even in the Python documentation itself where one > frequently asks oneself "Uhh... so what is parameter X supposed to be... > a string... a list... ?" Could you provide an actual example to support this? The only places I tend to see 'x' as a paramet

Re: Selenium/SauceLabs OpenSpace at Pycon

2010-02-03 Thread Aahz
In article , Raymond Hettinger wrote: > >For those who are interested, the Sauce Labs team, >http://saucelabs.com/about/team, is hosting two free tutorial open >space sessions at Pycon in Atlanta. Congrats on the new job! -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncra

Re: simple and fast platform independent IPC

2010-02-03 Thread bobicanprogram
On Feb 3, 3:32 am, News123 wrote: > Hi, > > I wondered what IPC library might be best simplest for following task? > > I'm having a few python scripts all running on the same host (linux or > win), which are started manually in random order. (no common parent process) > Each process might be ident

Re: Dreaming of new generation IDE

2010-02-03 Thread Ben Finney
Steven D'Aprano writes: > On Wed, 03 Feb 2010 18:48:12 +0300, Vladimir Ignatov wrote: > > […] system "knows" all your identifiers and just regenerates > > relevant portions of text from internal database-alike > > representation. You will probably want to learn about “refactoring” to see if that

Re: Dreaming of new generation IDE

2010-02-03 Thread Ben Finney
Robert Kern writes: > It is perfectly reasonable (and often necessary) for the unit test of > class B to use a mock object instead of a real A() instance. The unit > test for class B will fail to catch the renaming of A.foo() to A.bar() > because it never tries to call .foo() on a real A instance

Re: equivalent of Ruby's Pathname?

2010-02-03 Thread alex23
On Feb 4, 8:47 am, Phlip wrote: > Yes, calling os.path.walk() and os.path.join() all the time on raw > strings is fun, but I seem to recall from my Ruby days a class called > Pathname, which presented an object that behaved like a string at > need, and like a filesystem path at need. path + 'folde

Re: Python and Ruby

2010-02-03 Thread alex23
"Timothy N. Tsvetkov" wrote: > Jonathan Gardner > > Python is much, much cleaner. I don't know how anyone can honestly say > > Ruby is cleaner than Python. > > I developed on both (Python was first) and I think that ruby I > very clean and maybe cleaner than Python. > > And you're wrong with bloc

Re: Python 3 minor irritation

2010-02-03 Thread Alf P. Steinbach
* David Monaghan: I have a small program which reads files from the directory in which it resides. It's written in Python 3 and when run through IDLE or PythonWin works fine. If I double-click the file, it works fine in Python 2.6, but in 3 it fails because it looks for the files to load in the P

Re: Repeat an exception

2010-02-03 Thread Alf P. Steinbach
* mf: I'm translating a db from english to spanish with the Google translator API. The problem is when a TranslationError occurs(usually because of connection problems). I can except the first one, but I don't know how to except again. I "solved" the problem by saving temp db's and then joining t

Re: Code snippet: dualmethod descriptor

2010-02-03 Thread Gabriel Genellina
En Sat, 30 Jan 2010 03:06:18 -0300, Steven D'Aprano escribió: class dualmethod(object): """Descriptor implementing dualmethods (combination class/instance method). Returns a method which takes either an instance or a class as the first argument. When called on an instance, the

Re: Python 3 minor irritation

2010-02-03 Thread Benjamin Kaplan
On Wed, Feb 3, 2010 at 9:56 PM, Alf P. Steinbach wrote: > * David Monaghan: >> >> I have a small program which reads files from the directory in which it >> resides. It's written in Python 3 and when run through IDLE or PythonWin >> works fine. If I double-click the file, it works fine in Python 2

Re: Repeat an exception

2010-02-03 Thread MRAB
Alf P. Steinbach wrote: * mf: I'm translating a db from english to spanish with the Google translator API. The problem is when a TranslationError occurs(usually because of connection problems). I can except the first one, but I don't know how to except again. I "solved" the problem by saving tem

Re: Overcoming python performance penalty for multicore CPU

2010-02-03 Thread John Nagle
Paul Rubin wrote: John Nagle writes: Analysis of each domain is performed in a separate process, but each process uses multiple threads to read process several web pages simultaneously. Some of the threads go compute-bound for a second or two at a time as they parse web pages. You're pr

Refreshing of urllib.urlopen()

2010-02-03 Thread Michael Gruenstaeudl
Hi, I am fairly new to Python and need advice on the urllib.urlopen() function. The website I am trying to open automatically refreshes after 5 seconds and remains stable thereafter. With urllib.urlopen().read() I can only read the initial but not the refreshed page. How can I access the r

Re: Repeat an exception

2010-02-03 Thread Alf P. Steinbach
* MRAB: Alf P. Steinbach wrote: * mf: I'm translating a db from english to spanish with the Google translator API. The problem is when a TranslationError occurs(usually because of connection problems). I can except the first one, but I don't know how to except again. I "solved" the problem by s

Re: Background Zones in Pylab Plot

2010-02-03 Thread CM
On Feb 3, 10:49 am, Wanderer wrote: > I would like to add background zones in pylab plots. Colored sections > of the background that the curves pass through. Is this possible? My > google searches don't turn up anything but maybe my search terms > aren't the right ones. > > Thanks If you look at

Re: Overcoming python performance penalty for multicore CPU

2010-02-03 Thread Steve Holden
John Nagle wrote: > Paul Rubin wrote: >> John Nagle writes: >>> Analysis of each domain is >>> performed in a separate process, but each process uses multiple >>> threads to read process several web pages simultaneously. >>> >>>Some of the threads go compute-bound for a second or two at a time

Problem with __init__.py in Python3.1

2010-02-03 Thread Hidura
Good evening list, I have a really big trouble with the imports in the 3.1 version(Notes: In the older 2.64 theres no problems), I have two packages, the first package Utilities who contains Writer the second package, Writers contain the module tagmanip(What is imported in the best way inside the _

Re: Refreshing of urllib.urlopen()

2010-02-03 Thread Steve Holden
Michael Gruenstaeudl wrote: > Hi, > I am fairly new to Python and need advice on the urllib.urlopen() > function. The website I am trying to open automatically refreshes after > 5 seconds and remains stable thereafter. With urllib.urlopen().read() I > can only read the initial but not the refreshed

Re: Dreaming of new generation IDE

2010-02-03 Thread Vladimir Ignatov
>> > […] system "knows" all your identifiers and just regenerates >> > relevant portions of text from internal database-alike >> > representation. > > You will probably want to learn about “refactoring” to see if that's > related to what you mean http://www.refactoring.com/>. I mean if system actu

Re: Python 3 minor irritation

2010-02-03 Thread Alf P. Steinbach
* Benjamin Kaplan: On Wed, Feb 3, 2010 at 9:56 PM, Alf P. Steinbach wrote: * David Monaghan: I have a small program which reads files from the directory in which it resides. It's written in Python 3 and when run through IDLE or PythonWin works fine. If I double-click the file, it works fine in

Re: Python 3 minor irritation

2010-02-03 Thread Benjamin Kaplan
On Wed, Feb 3, 2010 at 11:18 PM, Alf P. Steinbach wrote: > * Benjamin Kaplan: >> >> On Wed, Feb 3, 2010 at 9:56 PM, Alf P. Steinbach wrote: >>> >>> * David Monaghan: I have a small program which reads files from the directory in which it resides. It's written in Python 3 and when r

Re: Python 3 minor irritation

2010-02-03 Thread Alf P. Steinbach
* Benjamin Kaplan: On Wed, Feb 3, 2010 at 11:18 PM, Alf P. Steinbach wrote: * Benjamin Kaplan: On Wed, Feb 3, 2010 at 9:56 PM, Alf P. Steinbach wrote: * David Monaghan: I have a small program which reads files from the directory in which it resides. It's written in Python 3 and when run thr

Re: Python 3 minor irritation

2010-02-03 Thread Alf P. Steinbach
* Alf P. Steinbach: * Benjamin Kaplan: On Wed, Feb 3, 2010 at 11:18 PM, Alf P. Steinbach wrote: * Benjamin Kaplan: The easiest way to solve this permanently, by the way, is to not use relative paths. All it takes is one script to call os.chdir and the script breaks. You can use __file__ and t

Re: Overcoming python performance penalty for multicore CPU

2010-02-03 Thread John Nagle
Steve Holden wrote: John Nagle wrote: Paul Rubin wrote: John Nagle writes: Analysis of each domain is performed in a separate process, but each process uses multiple threads to read process several web pages simultaneously. Some of the threads go compute-bound for a second or two at a tim

Re: Refreshing of urllib.urlopen()

2010-02-03 Thread Gabriel Genellina
En Thu, 04 Feb 2010 00:33:08 -0300, Michael Gruenstaeudl escribió: I am fairly new to Python and need advice on the urllib.urlopen() function. The website I am trying to open automatically refreshes after 5 seconds and remains stable thereafter. With urllib.urlopen().read() I can only re

Re: Problem with __init__.py in Python3.1

2010-02-03 Thread Gabriel Genellina
En Thu, 04 Feb 2010 01:00:56 -0300, Hidura escribió: Good evening list, I have a really big trouble with the imports in the 3.1 version(Notes: In the older 2.64 theres no problems), I have two packages, the first package Utilities who contains Writer the second package, Writers contain th

Re: Python 3 minor irritation

2010-02-03 Thread Gabriel Genellina
En Thu, 04 Feb 2010 02:46:45 -0300, Alf P. Steinbach escribió: Oh sorry, now I see what you mean. I read it too literally. You mean that at script startup __file__ is a valid relative or absolute path to the script. But anyways, Windows Explorer doesn't change the current directory to

Re: Dreaming of new generation IDE

2010-02-03 Thread David Cournapeau
On Thu, Feb 4, 2010 at 1:13 PM, Vladimir Ignatov wrote: >>> > […] system "knows" all your identifiers and just regenerates >>> > relevant portions of text from internal database-alike >>> > representation. >> >> You will probably want to learn about “refactoring” to see if that's >> related to wha

python via netcat

2010-02-03 Thread Niitsuma Hirotaka
I write little script run python via netcat http://www2s.biglobe.ne.jp/~niitsuma/jsonrpcdirect.html Usage $ netcat localhost 31415 {"method": "numpy.linalg.norm", "params": [[2,2]], "id": 0} then get response {"result": 2.8284271247461903, "error": null, "id": 0} -- http://mail.python.org/m

Re: python admin abuse complaint

2010-02-03 Thread Stephen Thorne
On Feb 3, 6:40 am, Xah Lee wrote: > This is a short complaint on adminabuseon #pythonircchannel on > freenode.net. > > Here's a log: > > 2010-02-02 > > (12:11:57 PM) The topic for #pythonis: NO LOL |http://pound-python.org/ > | It's too early to usePython3.x | Pasting > 3 lines? > Pastebin:http:/

<    1   2