ANN: PiCloud cloud library 1.8 release

2010-02-19 Thread Ken Elkabany
PiCloud, a cloud-computing platform for the Python Programming Language, has released version 1.8 of its client library, cloud. PiCloud enables Python users to leverage the power of an on-demand, high performance, and auto scaling compute cluster with as few as three lines of code! No server

Re: Few questions on SOAP

2010-02-19 Thread joy99
On Feb 19, 8:49 am, Steve Holden st...@holdenweb.com wrote: Brendon Wickham wrote: On 19 February 2010 08:07, Mark Lawrence breamore...@yahoo.co.uk wrote: Muhammad Alkarouri wrote: Your question is borderline if not out of topic in this group. I will make a few comments though. This

Re: How to make an empty generator?

2010-02-19 Thread Arnaud Delobelle
Ben Finney ben+pyt...@benfinney.id.au writes: Arnaud Delobelle arno...@googlemail.com writes: What about foo = iter('') That doesn't return a generator. foo = iter('') foo listiterator object at 0xf7cd3ed0 Whether the OP needs to create a generator, or just any

Submit HTTP GET data from XP PC to PHP on web server.

2010-02-19 Thread Schedule
Hello everyone I haeve tried to understand the capabilities of python in web development. Have gone throuhg forums and online tutorials. Nevertheless I am not able to find any topic which can give me some insite along with basic examples of how to send http get data from an xp mashine using

Re: How to make an empty generator?

2010-02-19 Thread Ben Finney
Arnaud Delobelle arno...@googlemail.com writes: Ben Finney ben+pyt...@benfinney.id.au writes: Whether the OP needs to create a generator, or just any iterable type, isn't clear. If it walks and quacks like a duck... Anyway it's not just an iterable object, it's an iterator. I can't

Re: Why this doesn't work?

2010-02-19 Thread Bruno Desthuilliers
mk a écrit : (snip) Sorry, no time to get into details now - but I can at least provide a couple hints. The first point is that, to override a method on an _instance_, you have to provide a method object, not a plain function - remember that the descriptor protocol is only invoked on

Re: How to use AWS/PAA nowadays? PyAWS / pyamazon outdated?

2010-02-19 Thread Snaky Love
wow, for some strange reason I did not find this with my first search yesterday: http://pypi.python.org/pypi/python-amazon-product-api/0.2.2 I will try this. sometime I wish all the old stuff would disappear from the internet. if somebody is looking for a cool startup idea: what about some

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Anh Hai Trinh
On Feb 19, 1:44 pm, Steve Howell showel...@yahoo.com wrote: def coroutine(co):    def _inner(*args, **kwargs):        gen = co(*args, **kwargs)        gen.next()        return gen    return _inner def squares_and_cubes(lst, target):    for n in lst:        target.send((n * n, n

Re: Constraints on __sub__, __eq__, etc.

2010-02-19 Thread Roald de Vries
On Feb 18, 2010, at 5:28 PM, Stephen Hansen wrote: On Thu, Feb 18, 2010 at 8:19 AM, Andrey Fedorov anfedo...@gmail.comwrote: It seems intuitive to me that the magic methods for overriding the +, -, , ==, , etc. operators should have no sideffects on their operands. Also, that == should be

Re: Constraints on __sub__, __eq__, etc.

2010-02-19 Thread Chris Rebert
On Fri, Feb 19, 2010 at 2:30 AM, Roald de Vries r...@roalddevries.nl wrote: On Feb 18, 2010, at 5:28 PM, Stephen Hansen wrote: On Thu, Feb 18, 2010 at 8:19 AM, Andrey Fedorov anfedo...@gmail.comwrote: It seems intuitive to me that the magic methods for overriding the +, -, , ==, , etc.

The Disappearing Program?

2010-02-19 Thread W. eWatson
I've successfully compiled several small python programs on Win XP into executables using py2exe. A program goes from a name like snowball.py to snowball. A dir in the command prompt window finds snowball.py but not snowball. If I type in snowball, it executes. What's up with that? --

Re: Constraints on __sub__, __eq__, etc.

2010-02-19 Thread Peter Otten
Roald de Vries wrote: On Feb 18, 2010, at 5:28 PM, Stephen Hansen wrote: On Thu, Feb 18, 2010 at 8:19 AM, Andrey Fedorov anfedo...@gmail.comwrote: It seems intuitive to me that the magic methods for overriding the +, -, , ==, , etc. operators should have no sideffects on their operands.

how to do filetransfer using usrp.

2010-02-19 Thread sarosh
how to do filetransfer using usrp. can i make lan interface between two computers connected to usrp each and then transfer files (images/video) between them? how to transfer files? is there any example of such kind in gnuradio? sarosh -- View this message in context:

Re: with statement and standard library

2010-02-19 Thread alex23
nobrowser nobrow...@gmail.com wrote: Yet there are many, many classes in the library whose use would be more elegant and readable if the with statement could be employed.  Start with the connection objects in httplib and you can probably come up with 10 others easily.  Maybe it is the case

Re: The Disappearing Program?

2010-02-19 Thread Andre Engels
On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson wolftra...@invalid.com wrote: I've successfully compiled several small python programs on Win XP into executables using py2exe. A program goes from a name like snowball.py to snowball. A dir in the command prompt window finds snowball.py but not

Re: The Disappearing Program?

2010-02-19 Thread Mark Lawrence
Andre Engels wrote: On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson wolftra...@invalid.com wrote: I've successfully compiled several small python programs on Win XP into executables using py2exe. A program goes from a name like snowball.py to snowball. A dir in the command prompt window finds

Re: The Disappearing Program?

2010-02-19 Thread Andre Engels
On Fri, Feb 19, 2010 at 3:19 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: Andre Engels wrote: On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson wolftra...@invalid.com wrote: I've successfully compiled several small python programs on Win XP into executables using py2exe. A program goes from

Re: Why this doesn't work?

2010-02-19 Thread mk
Steven D'Aprano wrote: On Thu, 18 Feb 2010 18:28:44 +0100, mk wrote: nostat.__orig_get__ = nostat.__get__ I should point out that leading-and-trailing-double-underscore names are reserved for use by the language. Right... I completely missed that. I will try to change the habit. I

Re: Submit HTTP GET data from XP PC to PHP on web server.

2010-02-19 Thread Joe Riopel
On Fri, Feb 19, 2010 at 3:54 AM, Schedule ssched...@gmail.com wrote: Hello everyone I haeve tried to understand the capabilities of python in web development. Have gone throuhg forums and online tutorials. Nevertheless I am not able to find any topic which can give me some insite along with

Re: Why this doesn't work?

2010-02-19 Thread mk
John Posner wrote: a False I expected to see 'nostatget' output: nostat.__get__ = nostatget obviously failed to replace this function's __get__ method. I don't quite understand the above sentence, so I'm assuming that you wanted the final is test to be True instead of False. No. I should

Re: how to do filetransfer using usrp.

2010-02-19 Thread Justin Ezequiel
On Feb 19, 7:38 pm, sarosh sarosh.n...@hotmail.com wrote: how to do filetransfer using usrp. can i make lan interface between two computers connected to usrp each and then transfer files (images/video) between them? how to transfer files? is there any example of such kind in gnuradio?

What happened to pyjamas?

2010-02-19 Thread John Pinner
It appears that, in trying to cut down spm, somone chahnged a DNS entry and screwed it up : it shouldbe back before long. John -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Why this doesn't work?

2010-02-19 Thread Bruno Desthuilliers
mk a écrit : Steven D'Aprano wrote: On Thu, 18 Feb 2010 18:28:44 +0100, mk wrote: nostat.__orig_get__ = nostat.__get__ I should point out that leading-and-trailing-double-underscore names are reserved for use by the language. Right... I completely missed that. I will try to change

Attributes in privates methods

2010-02-19 Thread Yasser Almeida Hernández
Hi all. I have a class with the attribute 'log_file', opened out of the class: class ProteinCluster: def __init__(self,cluster_name,log_file): ... self.log_file = log_file ... Then i have a private method which write in the log_file: def _read_structure(self, pdb_code):

Re: The Disappearing Program?

2010-02-19 Thread Mark Lawrence
Andre Engels wrote: On Fri, Feb 19, 2010 at 3:19 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: Andre Engels wrote: On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson wolftra...@invalid.com wrote: I've successfully compiled several small python programs on Win XP into executables using py2exe. A

Re: Why this doesn't work?

2010-02-19 Thread Bruno Desthuilliers
mk a écrit : John Posner wrote: a False I expected to see 'nostatget' output: nostat.__get__ = nostatget obviously failed to replace this function's __get__ method. I don't quite understand the above sentence, so I'm assuming that you wanted the final is test to be True instead of False.

Re: Attributes in privates methods

2010-02-19 Thread Diez B. Roggisch
Am 19.02.10 16:08, schrieb Yasser Almeida Hernández: Hi all. I have a class with the attribute 'log_file', opened out of the class: class ProteinCluster: def __init__(self,cluster_name,log_file): ... self.log_file = log_file ... Then i have a private method which write in the log_file: def

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Roald de Vries
This pipeline idea has actually been implemented further, see http:// blog.onideas.ws/stream.py. from stream import map, filter, cut range(10) map(lambda x: [x**2, x**3]) filter(lambda t: t[0]! =25 and t[1]!=64) cut[1] list [0, 1, 8, 27, 216, 343, 512, 729] Wow, cool! Just to show that

Re: How to make an empty generator?

2010-02-19 Thread Robert Kern
On 2010-02-19 00:21 AM, Steven D'Aprano wrote: On Fri, 19 Feb 2010 00:15:20 -0600, Robert Kern wrote: What's the point of the wheel spinning? Did I miss something? I wonder whether it's for some kind of framework with a main loop like for it in list_of_iterables: for x in it:

Executing Python code on another computer

2010-02-19 Thread SiWi
Hello community, I googled for an answer of the following problem, but I couldn't find anything. I've got a netbook and my fast workstation compter, which I usually use for developing. But I'd also like to take my netbook around the house and to develop Python programms on it. The problem is that

Re: How to make an empty generator?

2010-02-19 Thread Robert Kern
On 2010-02-19 01:01 AM, Ben Finney wrote: Robert Kernrobert.k...@gmail.com writes: On 2010-02-18 18:33 PM, Ben Finney wrote: Robert Kernrobert.k...@gmail.com writes: He doesn't want *any* empty generator. He wants an iterator that executes some given side-effect-producing code then

Re: with statement and standard library

2010-02-19 Thread Robert Kern
On 2010-02-19 01:18 AM, nobrowser wrote: Hi. The with statement is certainly nifty. The trouble is, the *only* two documented examples how it can be used with the library classes are file objects (which I use all the time) and thread locks which I almost never use. Yet there are many, many

Re: Executing Python code on another computer

2010-02-19 Thread D'Arcy J.M. Cain
On Fri, 19 Feb 2010 07:52:59 -0800 (PST) SiWi wimmersi...@googlemail.com wrote: So I wondered if it was possible to send the Python code I'm developing on the netbook to the workstation pc via wlan, let the script execute on the workstation pc and write the output back on the netbook. Is

Question about getmtime

2010-02-19 Thread Brandon
Hi everyone, Does copying or moving a file affect the return value of os.path.getmtime(path)? Thank you, Brandon -- http://mail.python.org/mailman/listinfo/python-list

Re: Executing Python code on another computer

2010-02-19 Thread Krister Svanlund
On Fri, Feb 19, 2010 at 4:52 PM, SiWi wimmersi...@googlemail.com wrote: Hello community, I googled for an answer of the following problem, but I couldn't find anything. I've got a netbook and my fast workstation compter, which I usually use for developing. But I'd also like to take my

A tool for find dependencies relationships behind Python projects

2010-02-19 Thread Victor Lin
Hi, I just wrote a tool for drawing dependencies relationships diagram of Python project on Pypi. Here is the home page of the tool: http://code.google.com/p/python-gluttony/ Some examples: Sprox: http://static.ez2learn.com/gluttony/sprox_dot.png TurboGears2:

Re: Question about getmtime

2010-02-19 Thread Krister Svanlund
On Fri, Feb 19, 2010 at 5:05 PM, Brandon btaylordes...@gmail.com wrote: Hi everyone, Does copying or moving a file affect the return value of os.path.getmtime(path)? Thank you, Brandon Wouldn't it be easier to make a script and see for yourself then to write a mail about it? --

a question on building MySQL-python

2010-02-19 Thread George Trojan
During installation of MySQL-python-1.2.3c1 I encountered the following error: $ python2.6 setup.py build running build running build_py copying MySQLdb/release.py - build/lib.linux-x86_64-2.6/MySQLdb running build_ext building '_mysql' extension creating build/temp.linux-x86_64-2.6 gcc

Re: Attributes in privates methods

2010-02-19 Thread Bruno Desthuilliers
Yasser Almeida Hernández a écrit : Hi all. I have a class with the attribute 'log_file', opened out of the class: class ProteinCluster: def __init__(self,cluster_name,log_file): ... self.log_file = log_file ... Then i have a private method which write in the log_file:

Re: Executing Python code on another computer

2010-02-19 Thread Arnaud Delobelle
On 19 Feb, 15:52, SiWi wimmersi...@googlemail.com wrote: Hello community, I googled for an answer of the following problem, but I couldn't find anything. I've got a netbook and my fast workstation compter, which I usually use for developing. But I'd also like to take my netbook around the

Re: Executing Python code on another computer

2010-02-19 Thread James Harris
On 19 Feb, 15:52, SiWi wimmersi...@googlemail.com wrote: Hello community, I googled for an answer of the following problem, but I couldn't find anything. I've got a netbook and my fast workstation compter, which I usually use for developing. But I'd also like to take my netbook around the

Re: Question about getmtime

2010-02-19 Thread Brandon
On Feb 19, 10:26 am, Krister Svanlund krister.svanl...@gmail.com wrote: On Fri, Feb 19, 2010 at 5:05 PM, Brandon btaylordes...@gmail.com wrote: Hi everyone, Does copying or moving a file affect the return value of os.path.getmtime(path)? Thank you, Brandon Wouldn't it be easier to

Re: Executing Python code on another computer

2010-02-19 Thread SiWi
On Feb 19, 5:10 pm, D'Arcy J.M. Cain da...@druid.net wrote: On Fri, 19 Feb 2010 07:52:59 -0800 (PST) SiWi wimmersi...@googlemail.com wrote: So I wondered if it was possible to send the Python code I'm developing on the netbook to the workstation pc via wlan, let the script execute on the

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Steve Howell
On Feb 19, 7:50 am, Roald de Vries r...@roalddevries.nl wrote: This pipeline idea has actually been implemented further, see http:// blog.onideas.ws/stream.py. from stream import map, filter, cut range(10) map(lambda x: [x**2, x**3]) filter(lambda t: t[0]! =25 and t[1]!=64) cut[1]

Re: Executing Python code on another computer

2010-02-19 Thread D'Arcy J.M. Cain
On Fri, 19 Feb 2010 08:32:48 -0800 (PST) SiWi wimmersi...@googlemail.com wrote: I'm normally using IDLE and sometimes PyScripter on Windows Vista. The netbook is Windows XP. Should I switch to Vim or Emacs? Umm... Yes? It's still not a Python question and is in fact a religious one. Other

Re: How to make an empty generator?

2010-02-19 Thread Steven D'Aprano
On Fri, 19 Feb 2010 09:51:54 -0600, Robert Kern wrote: On 2010-02-19 00:21 AM, Steven D'Aprano wrote: On Fri, 19 Feb 2010 00:15:20 -0600, Robert Kern wrote: What's the point of the wheel spinning? Did I miss something? I wonder whether it's for some kind of framework with a main loop like

Re: The Disappearing Program?

2010-02-19 Thread W. eWatson
On 2/19/2010 7:16 AM, Mark Lawrence wrote: Andre Engels wrote: On Fri, Feb 19, 2010 at 3:19 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: Andre Engels wrote: On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson wolftra...@invalid.com ... tories, or even the whole hard drive, for snowball.*. Then

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Steven D'Aprano
On Fri, 19 Feb 2010 08:32:53 -0800, Steve Howell wrote: The extra expressiveness of Ruby comes from the fact that you can add statements within the block, which I find useful sometimes just for debugging purposes: debug = true data = strange_dataset_from_third_party_code()

Re: with statement and standard library

2010-02-19 Thread Terry Reedy
On 2/19/2010 2:18 AM, nobrowser wrote: Hi. The with statement is certainly nifty. The trouble is, the *only* two documented examples how it can be used with the library classes are file objects (which I use all the time) and thread locks which I almost never use. Yet there are many, many

Re: How to make an empty generator?

2010-02-19 Thread Stephen Hansen
On Fri, Feb 19, 2010 at 9:21 AM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Fri, 19 Feb 2010 09:51:54 -0600, Robert Kern wrote: But he doesn't say anything about side-effects. I have some generators *that do stuff*, then start yielding results. [emphasis mine].

Re: best way to create a dict from string

2010-02-19 Thread MRAB
Tim Arnold wrote: Hi, I've got some text to parse that looks like this text = ''' blah blah blah \Template[Name=RAD,LMRB=False,LMRG=True]{tables} ho dee ho ''' If you're going to include backslashes in the string literal then use a raw string for safety. I want to extract the bit between the

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Steve Howell
On Feb 19, 9:30 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Fri, 19 Feb 2010 08:32:53 -0800, Steve Howell wrote: The extra expressiveness of Ruby comes from the fact that you can add statements within the block, which I find useful sometimes just for debugging

speed question, reading csv using takewhile() and dropwhile()

2010-02-19 Thread Vincent Davis
I have some some (~50) text files that have about 250,000 rows each. I am reading them in using the following which gets me what I want. But it is not fast. Is there something I am missing that should help. This is mostly an question to help me learn more about python. It takes about 4 min right

Re: What happened to pyjamas?

2010-02-19 Thread Daniele Gondoni
On 18 Feb, 19:58, sstein...@gmail.com sstein...@gmail.com wrote: Down from here (NH, US). S On Feb 18, 2010, at 1:44 PM, Chris Colbert wrote: Unreacheable from Italy as well... -- http://mail.python.org/mailman/listinfo/python-list

Re: What happened to pyjamas?

2010-02-19 Thread Luis M . González
On Feb 18, 5:21 pm, Daniele Gondoni daniele.gond...@gmail.com wrote: On 18 Feb, 19:58, sstein...@gmail.com sstein...@gmail.com wrote: Down from here (NH, US). S On Feb 18, 2010, at 1:44 PM, Chris Colbert wrote: Unreacheable from Italy as well... Same here (Buenos Aires, Argentina). --

Re: unit testing a routine that sends mail

2010-02-19 Thread Bruno Desthuilliers
commander_coder a écrit : Hello, I have a routine that sends an email (this is how a Django view notifies me that an event has happened). I want to unit test that routine. http://docs.djangoproject.com/en/dev/topics/email/#e-mail-backends Or if you're stuck with 1.x 1.2a, you could just

Re: Replacement for e.message() in python 2.6

2010-02-19 Thread Chris Prinos
On Feb 17, 4:58 am, Nandakumar Chandrasekhar navanitach...@gmail.com wrote: Dear Folks, In previous versions of Python I used to use e.message() to print out the error message of an exception like so: try:         result = x / y except ZeroDivisionError, e:         print e.message()

Re: What happened to pyjamas?

2010-02-19 Thread Daniele Gondoni
On Feb 18, 9:53 pm, Irmen de Jong ir...@-nospam-xs4all.nl wrote: On 2/18/10 9:45 PM, Luis M. González wrote: On Feb 18, 5:21 pm, Daniele Gondonidaniele.gond...@gmail.com  wrote: On 18 Feb, 19:58, sstein...@gmail.comsstein...@gmail.com  wrote: Down from here (NH, US). S On Feb 18,

Re: What happened to pyjamas?

2010-02-19 Thread Irmen de Jong
On 2/18/10 9:45 PM, Luis M. González wrote: On Feb 18, 5:21 pm, Daniele Gondonidaniele.gond...@gmail.com wrote: On 18 Feb, 19:58, sstein...@gmail.comsstein...@gmail.com wrote: Down from here (NH, US). S On Feb 18, 2010, at 1:44 PM, Chris Colbert wrote: Unreacheable from Italy as

Trouble running pywin32-214.win-amd64-py3.1 on 64-bit Windows 7

2010-02-19 Thread Steven Cohen
Hello, I downloaded pywin32-214.win-amd64-py3.1, and it installs just fine (except that it prints a traceback when it tells me the postinstall script completed), but then when I try to execute Pythonwin.exe, I get the following error popup: The application can not locate win32ui.pyd (or Python)

Re: Executing Python code on another computer

2010-02-19 Thread Jean-Michel Pichavant
SiWi wrote: On Feb 19, 5:10 pm, D'Arcy J.M. Cain da...@druid.net wrote: On Fri, 19 Feb 2010 07:52:59 -0800 (PST) SiWi wimmersi...@googlemail.com wrote: So I wondered if it was possible to send the Python code I'm developing on the netbook to the workstation pc via wlan, let the script

Re: The Disappearing Program?

2010-02-19 Thread CM
On Feb 19, 12:21 pm, W. eWatson wolftra...@invalid.com wrote: On 2/19/2010 7:16 AM, Mark Lawrence wrote: Andre Engels wrote: On Fri, Feb 19, 2010 at 3:19 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: Andre Engels wrote: On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson

Re: Question about getmtime

2010-02-19 Thread Dave Angel
Brandon wrote: On Feb 19, 10:26 am, Krister Svanlund krister.svanl...@gmail.com wrote: On Fri, Feb 19, 2010 at 5:05 PM, Brandon btaylordes...@gmail.com wrote: Hi everyone, Does copying or moving a file affect the return value of os.path.getmtime(path)? Thank you,

Re: Executing Python code on another computer

2010-02-19 Thread Dave Angel
SiWi wrote: On Feb 19, 5:10 pm, D'Arcy J.M. Cain da...@druid.net wrote: On Fri, 19 Feb 2010 07:52:59 -0800 (PST) SiWi wimmersi...@googlemail.com wrote: So I wondered if it was possible to send the Python code I'm developing on the netbook to the workstation pc via wlan, let the script

Re: Upgrading Py2exe App

2010-02-19 Thread T
On Feb 18, 7:19 pm, Ryan Kelly r...@rfk.id.au wrote: On Thu, 2010-02-18 at 07:46 -0800, T wrote: I have a Python app which I converted to an EXE (all files separate; single EXE didn't work properly) via py2exe - I plan on distributing this and would like the ability to remotely upgrade the

Chaining 501 generators breaks everything?

2010-02-19 Thread Andrey Fedorov
I implemented a Sieve of Eratostheneshttp://en.wikipedia.org/wiki/Sieve_of_Eratosthenesprimes algorithm using generators: http://gist.github.com/309109 This code which chains together 500 generators works fine (~1/20th of a second) on my laptop. The code which chaines 501 generators (s/498/499/

Re: Chaining 501 generators breaks everything?

2010-02-19 Thread Andrey Fedorov
Ack, just ran it from shell, realized my editor was just choking on a maximum recursion depth exceeded RuntimeError. Didn't realize generators used the call stack... - Andrey On Fri, Feb 19, 2010 at 2:47 PM, Andrey Fedorov anfedo...@gmail.com wrote: I implemented a Sieve of

Re: How to make an empty generator?

2010-02-19 Thread John Posner
On 2/19/2010 2:25 PM, Terry Reedy wrote: On 2/19/2010 12:44 PM, Stephen Hansen wrote: Much to my embarrassment, sometime last night I realized I was being a complete idiot, and the 'correct' way to handle this in my scenario is really just: def initialize(): # do one time processing here

Re: speed question, reading csv using takewhile() and dropwhile()

2010-02-19 Thread John Posner
On 2/19/2010 3:02 PM, MRAB wrote: Is this any better? def read_data_file(filename): reader = csv.reader(open(filename, U),delimiter='\t') data = [] for row in reader: if '[MASKS]' in row: break data.append(row) As noted in another thread recently, you

Re: speed question, reading csv using takewhile() and dropwhile()

2010-02-19 Thread Jonathan Gardner
On Fri, Feb 19, 2010 at 10:22 AM, Vincent Davis vinc...@vincentdavis.netwrote: I have some some (~50) text files that have about 250,000 rows each. I am reading them in using the following which gets me what I want. But it is not fast. Is there something I am missing that should help. This is

Re: Upgrading Py2exe App

2010-02-19 Thread Ryan Kelly
On Thu, 2010-02-18 at 20:32 -0800, CM wrote: On Feb 18, 7:19 pm, Ryan Kelly r...@rfk.id.au wrote: On Thu, 2010-02-18 at 07:46 -0800, T wrote: I have a Python app which I converted to an EXE (all files separate; single EXE didn't work properly) via py2exe - I plan on distributing this

Re: Upgrading Py2exe App

2010-02-19 Thread Ryan Kelly
On Fri, 2010-02-19 at 11:08 -0800, T wrote: On Feb 18, 7:19 pm, Ryan Kelly r...@rfk.id.au wrote: On Thu, 2010-02-18 at 07:46 -0800, T wrote: I have a Python app which I converted to an EXE (all files separate; single EXE didn't work properly) via py2exe - I plan on distributing this

Re: The Disappearing Program?

2010-02-19 Thread W. eWatson
On 2/19/2010 10:56 AM, CM wrote: On Feb 19, 12:21 pm, W. eWatsonwolftra...@invalid.com wrote: On 2/19/2010 7:16 AM, Mark Lawrence wrote: Andre Engels wrote: On Fri, Feb 19, 2010 at 3:19 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: Andre Engels wrote: On Fri, Feb 19, 2010 at 12:20 PM,

Re: Chaining 501 generators breaks everything?

2010-02-19 Thread Jonathan Gardner
On Fri, Feb 19, 2010 at 11:47 AM, Andrey Fedorov anfedo...@gmail.com wrote: I implemented a Sieve of Eratosthenes primes algorithm using generators: http://gist.github.com/309109 This code which chains together 500 generators works fine (~1/20th of a second) on my laptop. You may want a

Can't Access ANY url from python (errno 61)

2010-02-19 Thread MattB
Hey all, I've been working on a program that accesses my school's password protected website and downloads directory names. I'm using mechanize. Recently, the program has been unable to open the website, returning the 'errno 61 connection refused' error. I presume the school's server was

Re: The Disappearing Program?

2010-02-19 Thread Stephen Hansen
On Fri, Feb 19, 2010 at 1:42 PM, W. eWatson wolftra...@invalid.com wrote: Well, you are right. What proof do I have? In fact, I just tried to run a program that was not converted, and left off py. It worked. So maybe the only way to execute the compiled code is to to to dist? Yes. You're

Re: speed question, reading csv using takewhile() and dropwhile()

2010-02-19 Thread Vincent Davis
In reference to the several comments about [x for x in read] is basically a copy of the entire list. This isn't necessary. or list(read). I had thought I had a problem with having iterators in the takewhile() statement. I thought I testes and it didn't work. It seems I was wrong. It clearly works.

Re: Can't Access ANY url from python (errno 61)

2010-02-19 Thread Jonathan Gardner
On Fri, Feb 19, 2010 at 1:48 PM, MattB mattbar...@gmail.com wrote: I've been working on a program that accesses my school's password protected website and downloads directory names. I'm using mechanize. Recently, the program has been unable to open the website, returning the 'errno 61

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lie Ryan
On 02/19/10 14:57, Steve Howell wrote: In a more real world example, the intermediate results would be something like this: departments departments_in_new_york departments_in_new_york_not_on_bonus_cycle employees_in_departments_in_new_york_not_on_bonus_cycle

Re: Can't Access ANY url from python (errno 61)

2010-02-19 Thread Chris Rebert
On Fri, Feb 19, 2010 at 1:48 PM, MattB mattbar...@gmail.com wrote: Hey all, I've been working on a program that accesses my school's password protected website and downloads directory names. I'm using mechanize. Recently, the program has been unable to open the website, returning the 'errno

Re: Question about getmtime

2010-02-19 Thread Sean DiZazzo
On Feb 19, 10:06 am, MRAB pyt...@mrabarnett.plus.com wrote: Brandon wrote: Hi everyone, Does copying or moving a file affect the return value of os.path.getmtime(path)? The modification time of a copied file should be the same as the original. The creation time of a copied file will

ActiveState/O'Reilly Launch New and Improved Code Share Site (Python)

2010-02-19 Thread Bret
ActiveState launched today the new code.activestate.com with code recipes for dynamic languages such as Python, Perl and Tcl and web development. This site is great recipe sharing site for all Python, Perl and Tcl developers. O'Reilly will be use recipes from the site for its next Python cook

Re: Can't Access ANY url from python (errno 61)

2010-02-19 Thread Martin P. Hellwig
On 02/19/10 21:48, MattB wrote: Hey all, I've been working on a program that accesses my school's password protected website and downloads directory names. I'm using mechanize. Recently, the program has been unable to open the website, returning the 'errno 61 connection refused' error. I

Re: Question about getmtime

2010-02-19 Thread MRAB
Sean DiZazzo wrote: On Feb 19, 10:06 am, MRAB pyt...@mrabarnett.plus.com wrote: Brandon wrote: Hi everyone, Does copying or moving a file affect the return value of os.path.getmtime(path)? The modification time of a copied file should be the same as the original. The creation time of a

Re: speed question, reading csv using takewhile() and dropwhile()

2010-02-19 Thread Jonathan Gardner
On Fri, Feb 19, 2010 at 1:58 PM, Vincent Davis vinc...@vincentdavis.netwrote: In reference to the several comments about [x for x in read] is basically a copy of the entire list. This isn't necessary. or list(read). I had thought I had a problem with having iterators in the takewhile()

Re: How to use python to register a service (an existing .exe file)

2010-02-19 Thread Aahz
In article 4b79e28c$0$4610$426a7...@news.free.fr, News123 news...@free.fr wrote: Is there a python way to register new windows services. I am aware of the instsrv.exe program, which can be used to install services. I could use subprocess.Popen to call instsrv.exe service_name program.exe but

Re: Can't Access ANY url from python (errno 61)

2010-02-19 Thread MattB
On Feb 19, 6:02 pm, Martin P. Hellwig martin.hell...@dcuktec.org wrote: On 02/19/10 21:48, MattB wrote: Hey all, I've been working on a program that accesses my school's password protected website and downloads directory names. I'm using mechanize. Recently, the program has been unable

Re: Can't Access ANY url from python (errno 61)

2010-02-19 Thread MattB
On Feb 19, 7:20 pm, MattB mattbar...@gmail.com wrote: On Feb 19, 6:02 pm, Martin P. Hellwig martin.hell...@dcuktec.org wrote: On 02/19/10 21:48, MattB wrote: Hey all, I've been working on a program that accesses my school's password protected website and downloads directory

Looking for crossfold validation code

2010-02-19 Thread Mark Livingstone
Hello, I am doing research as part of a Uni research Scholarship into using data compression for classification. What I am looking for is python code to handle the crossfold validation side of things for me - that will take my testing / training corpus and create the testing / training files

Re: Can't Access ANY url from python (errno 61)

2010-02-19 Thread Chris Rebert
On Fri, Feb 19, 2010 at 5:06 PM, MattB mattbar...@gmail.com wrote: On Feb 19, 7:20 pm, MattB mattbar...@gmail.com wrote: On Feb 19, 6:02 pm, Martin P. Hellwig martin.hell...@dcuktec.org wrote: On 02/19/10 21:48, MattB wrote: Hey all, I've been working on a program that accesses my

the mystery of dirname()

2010-02-19 Thread Shashwat Anand
In the following code sample : def dirname(p): Returns the directory component of a pathname i = p.rfind('/') + 1 head = p[:i] if head and head != '/'*len(head): head = head.rstrip('/') return head def dirname1(p): i = p.rfind('/') + 1 head = p[:i] if

Re: Can't Access ANY url from python (errno 61)

2010-02-19 Thread MattB
On Feb 19, 8:28 pm, Chris Rebert c...@rebertia.com wrote: On Fri, Feb 19, 2010 at 5:06 PM, MattB mattbar...@gmail.com wrote: On Feb 19, 7:20 pm, MattB mattbar...@gmail.com wrote: On Feb 19, 6:02 pm, Martin P. Hellwig martin.hell...@dcuktec.org wrote: On 02/19/10 21:48, MattB wrote:

Capturing errors raised by other scripts ?

2010-02-19 Thread northof40
I'm using the subroutine module to run run python script A.py from B.py (this is on windows fwiw). A.py is not my script and it may raise arbitary errors before exiting. How can I determine what's happened before A.py exited ? To simulate this I've got this script (which is meant to simulate

Re: Can't Access ANY url from python (errno 61)

2010-02-19 Thread Shashwat Anand
try this : url = 'http://www.google.com' proxy = {'http': 'http://username:passw...@proxy:port'} content = urllib.urlopen(url, proxies = proxy).read() Hopefully it should run without error. Second approach can be to check whether your environment variables are setup. $set will show you. If

Re: the mystery of dirname()

2010-02-19 Thread MRAB
Shashwat Anand wrote: In the following code sample : def dirname(p): Returns the directory component of a pathname i = p.rfind('/') + 1 head = p[:i] if head and head != '/'*len(head): head = head.rstrip('/') return head def dirname1(p): i = p.rfind('/') + 1

Re: the mystery of dirname()

2010-02-19 Thread Shashwat Anand
But this is posixpath, right ? So '//x' like path will not occur as far as I guess ? On Sat, Feb 20, 2010 at 8:35 AM, MRAB pyt...@mrabarnett.plus.com wrote: Shashwat Anand wrote: In the following code sample : def dirname(p): Returns the directory component of a pathname i =

Re: Capturing errors raised by other scripts ?

2010-02-19 Thread MRAB
northof40 wrote: I'm using the subroutine module to run run python script A.py from B.py (this is on windows fwiw). A.py is not my script and it may raise arbitary errors before exiting. How can I determine what's happened before A.py exited ? To simulate this I've got this script (which is

Re: the mystery of dirname()

2010-02-19 Thread MRAB
Shashwat Anand wrote: But this is posixpath, right ? So '//x' like path will not occur as far as I guess ? Can you guarantee that? It's safer to just leave it as it is, just in case! :-) On Sat, Feb 20, 2010 at 8:35 AM, MRAB pyt...@mrabarnett.plus.com mailto:pyt...@mrabarnett.plus.com

Re: the mystery of dirname()

2010-02-19 Thread Shashwat Anand
basically I infer that : dirname = path - basename, like for path = '//x', basename = x, hence dirname = '//' On Sat, Feb 20, 2010 at 8:47 AM, MRAB pyt...@mrabarnett.plus.com wrote: Shashwat Anand wrote: But this is posixpath, right ? So '//x' like path will not occur as far as I guess ?

Avoid converting functions to methods in a class

2010-02-19 Thread Steven D'Aprano
I have a convention when writing unit tests to put the target of the test into a class attribute, as follows: class MyTest(unittest.TestCase): target = mymodule.someclass def test_spam(self): Test that someclass has a spam attribute. self.failUnless(hasattr(self.target,

  1   2   >