Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Grant Edwards
On 2010-10-15, Martin Gregorie wrote: > On Fri, 15 Oct 2010 19:59:13 +, Grant Edwards wrote: > >> >> We're talking about Unix. >> We're not talking about CP/M, DOS, RSX-11m, Apple-SOS, etc. > > That's just your assumption. If you go back and look at my original posting in this thread, here's

Re: parse xml

2010-10-15 Thread Hidura
First every element represents a node so you have to use value=n.childNodes[0].nodeValue with that you'll have the 5000 2010/10/15, kostia : > I have xml file: > > > 5 > > > I want to get the value of n (= 5) inside my python program, I'm > doing this: > > import xml.dom.minidom

Re: Scheme as a virtual machine?

2010-10-15 Thread Ertugrul Söylemez
namekuseijin wrote: > On 14 out, 00:26, Ertugrul Söylemez wrote: > > BTW, you mentioned symbols ('$', '.' and '>>='), which are not > > syntactic sugar at all.  They are just normal functions, for which > > it makes sense to be infix.  The fact that you sold them as > > syntactic sugar or "perli

Re: what happens to Popen()'s parent-side file descriptors?

2010-10-15 Thread Chris Torek
>In message , Nobody wrote: >> Another gotcha regarding pipes: the reader only sees EOF once there are no >> writers, i.e. when the *last* writer closes their end. In article Lawrence D'Oliveiro wrote: >Been there, been bitten by that. "Nobody" mentioned the techniques of setting close_fds = T

Re: PyCharm

2010-10-15 Thread Lawrence D'Oliveiro
In message , Jeffrey Gaynor wrote: > One thing that bugs me in refactoring though is that renaming a method or > variable does not necessarily work. It's supposed to track down all > references and correctly change them, but it tends to be hit or miss. Given Python’s dynamic nature, I think that

Re: PyCharm

2010-10-15 Thread Lawrence D'Oliveiro
In message , Jean- Michel Pichavant wrote: > Who want's to be bothered by windows popping everytime you type a letter > anyway ? Apparently the Java and Visual Studio crowd are big on this sort of thing. -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-15 Thread Lawrence D'Oliveiro
In message , Steve Howell wrote: > On Oct 13, 8:32 pm, Lawrence D'Oliveiro > wrote: > >> In message >> , Steve >> Howell wrote: >> >>> Bulk-load strategies usually solve one or more of these problems: >> >>> network latency >> >> That’s not an issue. This is a bulk operation, after all. >> >>> i

Re: what happens to Popen()'s parent-side file descriptors?

2010-10-15 Thread Lawrence D'Oliveiro
In message , Nobody wrote: > Another gotcha regarding pipes: the reader only sees EOF once there are no > writers, i.e. when the *last* writer closes their end. Been there, been bitten by that. -- http://mail.python.org/mailman/listinfo/python-list

Re: Class-level variables - a scoping issue

2010-10-15 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: “Dynamically” is when that “future” becomes the present, so you can see it right in front of you, here, now. But raising an "UnboundAttributeError" when attempting to read a class attribute that *could*, but hasn't yet, been shadowed by an instance attribute requires

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Martin Gregorie
On Fri, 15 Oct 2010 19:59:13 +, Grant Edwards wrote: > > We're talking about Unix. > We're not talking about CP/M, DOS, RSX-11m, Apple-SOS, etc. > That's just your assumption. Track back up the thread and you'll see that the OP didn't mention an OS. He merely said that he was using zlib, and

PEP 380 - the 'yield from' proposal

2010-10-15 Thread Hallvard B Furuseth
Regarding http://www.python.org/dev/peps/pep-0380/, "Syntax for Delegating to a Subgenerator": The first call can only be .next(), there's no way to provide an initial value to .send(). That matches common use, but an initial .send() is possible if .next() was called before "yield from". So I su

Re: Windows binary stdin goes EOF after \x1a character

2010-10-15 Thread Neil Cerutti
On 2010-10-15, MRAB wrote: >> I wrote an equivalent program in C++ using the win32 >> ReadFile() call, and it read all 255 bytes just fine. What am >> I doing wrong with the python code? >> >> >> I am using Erlang to launch the Python program as a subprocess. The >> Erlang fragment that launches

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Grant Edwards
On 2010-10-15, Chris Torek wrote: >>> On 2010-10-15, Grant Edwards wrote: How do you create a [Unix] file with a name that contains a NULL byte? > >>On 2010-10-15, Seebs wrote: >>> So far as I know, in canonical Unix, you don't -- the syscalls all work >>> with something like C strings unde

Re: Windows binary stdin goes EOF after \x1a character

2010-10-15 Thread MRAB
On 15/10/2010 20:28, Dan wrote: I am writing a Windows program in Python 3.1.2 that reads binary data from stdin. Whenever it hits a \x1a character, stdin goes EOF and no more data can be read. A short program that exhibits this problem is: #listing of main.pyw import sys def go(): bb=sys

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Grant Edwards
On 2010-10-15, Seebs wrote: > On 2010-10-15, Grant Edwards wrote: >> Yes, all of the Unix syscalls use NULL-terminated path parameters >> (AKA "C strings"). What I don't know is whether the underlying >> filesystem code also uses NULL-terminated strings for filenames or if >> they have explicit

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Grant Edwards
On 2010-10-15, Martin Gregorie wrote: >> On 2010-10-15, Martin Gregorie wrote: >>> On Fri, 15 Oct 2010 17:02:07 +, Grant Edwards wrote: On 2010-10-15, Steven D'Aprano : > In the Unix world, which includes OS X, text tools tend to have > difficulty with tabs. Or try naming a

Re: Windows binary stdin goes EOF after \x1a character

2010-10-15 Thread Dan
On Oct 15, 2:42 pm, Neil Cerutti wrote: > On 2010-10-15, Dan wrote: > > > I am writing a Windows program in Python 3.1.2 that reads > > binary data from stdin.  Whenever it hits a \x1a character, > > stdin goes EOF and no more data can be read.  A short program > > that exhibits this problem is:

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Chris Torek
>> On 2010-10-15, Grant Edwards wrote: >>> How do you create a [Unix] file with a name that contains a NULL byte? >On 2010-10-15, Seebs wrote: >> So far as I know, in canonical Unix, you don't -- the syscalls all work >> with something like C strings under the hood, meaning that no matter what >

Re: Windows binary stdin goes EOF after \x1a character

2010-10-15 Thread Neil Cerutti
On 2010-10-15, Dan wrote: > I am writing a Windows program in Python 3.1.2 that reads > binary data from stdin. Whenever it hits a \x1a character, > stdin goes EOF and no more data can be read. A short program > that exhibits this problem is: stdin is not in binary mode. Try invoking with -u op

Re: Does everyone keep getting recruiting emails from google?

2010-10-15 Thread Ralph Malph
My understanding is that Google headhunters are contractors and not "regular" Google employees. This "hired gun" approach to recruiting may lead to the use of unusual methods in order to meet their requirements. -- http://mail.python.org/mailman/listinfo/python-list

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Seebs
On 2010-10-15, Grant Edwards wrote: > Yes, all of the Unix syscalls use NULL-terminated path parameters (AKA > "C strings"). What I don't know is whether the underlying filesystem > code also uses NULL-terminated strings for filenames or if they have > explicit lengths. If the latter, there migh

Windows binary stdin goes EOF after \x1a character

2010-10-15 Thread Dan
I am writing a Windows program in Python 3.1.2 that reads binary data from stdin. Whenever it hits a \x1a character, stdin goes EOF and no more data can be read. A short program that exhibits this problem is: #listing of main.pyw import sys def go(): bb=sys.stdin.buffer.raw.read(1) p

Re: parse xml

2010-10-15 Thread kostia
Thank you all! -- http://mail.python.org/mailman/listinfo/python-list

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Martin Gregorie
On Fri, 15 Oct 2010 18:14:13 +, Grant Edwards wrote: > On 2010-10-15, Martin Gregorie wrote: >> On Fri, 15 Oct 2010 17:02:07 +, Grant Edwards wrote: >> >>> On 2010-10-15, Steven D'Aprano >>> wrote: >>> In the Unix world, which includes OS X, text tools tend to have difficulty

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Grant Edwards
On 2010-10-15, Seebs wrote: > On 2010-10-15, Grant Edwards wrote: >> On 2010-10-15, Steven D'Aprano wrote: >>> In the Unix world, which includes OS X, text tools tend to have >>> difficulty with tabs. Or try naming a file with a newline or carriage >>> return in the file name, or a NULL byte. >

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Seebs
On 2010-10-15, Grant Edwards wrote: > On 2010-10-15, Steven D'Aprano wrote: >> In the Unix world, which includes OS X, text tools tend to have >> difficulty with tabs. Or try naming a file with a newline or carriage >> return in the file name, or a NULL byte. > How do you create a file with a n

Re: parse xml

2010-10-15 Thread MRAB
On 15/10/2010 18:49, kostia wrote: I have xml file: 5 I want to get the value of n (= 5) inside my python program, I'm doing this: import xml.dom.minidom from xml.dom.minidom import Node doc = xml.dom.minidom.parseString("boolean_width.xml") n = doc.getElementsByTagName("roo

Re: parse xml

2010-10-15 Thread Nitin Pawar
this is wrong xml.dom.minidom.parseString("boolean_width.xml") ... if u r parsing from String use string variable as argument or use parse only if parsing from file On Sat, Oct 16, 2010 at 12:07 AM, Andreas Waldenburger wrote: > On Fri, 15 Oct 2010 10:49:18 -0700 (PDT) kostia > wrote: > > > I h

Re: parse xml

2010-10-15 Thread Sudheer Satyanarayana
On 10/15/2010 11:19 PM, kostia wrote: I have xml file: 5 I want to get the value of n (= 5) inside my python program, I'm doing this: import xml.dom.minidom from xml.dom.minidom import Node doc = xml.dom.minidom.parseString("boolean_width.xml") Use parse to parse a file

Re: parse xml

2010-10-15 Thread Andreas Waldenburger
On Fri, 15 Oct 2010 10:49:18 -0700 (PDT) kostia wrote: > I have xml file: > > > 5 > > > I want to get the value of n (= 5) inside my python program, I'm > doing this: > > import xml.dom.minidom > from xml.dom.minidom import Node > doc = xml.dom.minidom.parseString("boolean_wi

Re: How to display unicode char in Windows

2010-10-15 Thread Mark Tolonen
"hiral" wrote in message news:90b62600-a0a4-47d5-bb6f-a3ae14cf6...@9g2000prn.googlegroups.com... Hi, I tried... # coding: latin-1 print "**" oo = "ö" print "char=<%s>" % oo print "

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Grant Edwards
On 2010-10-15, Martin Gregorie wrote: > On Fri, 15 Oct 2010 17:02:07 +, Grant Edwards wrote: > >> On 2010-10-15, Steven D'Aprano >> wrote: >> >>> In the Unix world, which includes OS X, text tools tend to have >>> difficulty with tabs. Or try naming a file with a newline or carriage >>> retu

Re: PyCharm

2010-10-15 Thread Robert H
On Oct 14, 4:16 pm, Jeffrey Gaynor wrote: > Yip. I'm using it and for the most part like it. But... > > I used their Java IDE for years (it totally rocks, highly recommended), so I > it is very comfortable to use PyCharm. > > One thing that bugs me in refactoring though is that renaming a method

Re: PyCharm

2010-10-15 Thread Robert H
On Oct 14, 8:49 pm, alex23 wrote: > Jeffrey Gaynor wrote: > > Certainly give it a shot. The only other IDE I found that was > > remotely close to it was Komodo which costs a lot more > > (Jetbrains is offering a 50% off coupon as a promotional offer > > for a while.) > > I recently tried out PyCh

Re: How to display unicode char in Windows

2010-10-15 Thread John Nagle
On 10/15/2010 4:57 AM, hiral wrote: Hi, I tried... # coding: latin-1 print "**" oo = "ö" print "char=<%s>" % oo print "**" but it is not printing "ö" char; any idea? Thank you. -Hi

parse xml

2010-10-15 Thread kostia
I have xml file: 5 I want to get the value of n (= 5) inside my python program, I'm doing this: import xml.dom.minidom from xml.dom.minidom import Node doc = xml.dom.minidom.parseString("boolean_width.xml") n = doc.getElementsByTagName("root")[0].firstChild.nodeValue.strip() pr

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Martin Gregorie
On Fri, 15 Oct 2010 17:02:07 +, Grant Edwards wrote: > On 2010-10-15, Steven D'Aprano > wrote: > >> In the Unix world, which includes OS X, text tools tend to have >> difficulty with tabs. Or try naming a file with a newline or carriage >> return in the file name, or a NULL byte. > > How do

Re: Weird try-except vs if behavior

2010-10-15 Thread Terry Reedy
On 10/15/2010 3:11 AM, Ryan Kelly wrote: On Thu, 2010-10-14 at 22:43 -0700, James Matthews wrote: Hi, I have this code http://gist.github.com/627687 (I don't like pasting code into the mailing list). Yes, but it makes it harder to discuss the ode and makes the archive that much more useless.

Re: open() throws permission error and I don't get why

2010-10-15 Thread Andy Theuninck
> I suspect that postfix is only setting the UID and the (primary) GID, > but not the supplementary GIDs. In which case, it doesn't matter whether > "nobody" is a member of the group. That does seem like a good explanation. I guess I'll have to re-think my approach a bit. sg sounds like it would g

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Grant Edwards
On 2010-10-15, Steven D'Aprano wrote: > In the Unix world, which includes OS X, text tools tend to have > difficulty with tabs. Or try naming a file with a newline or carriage > return in the file name, or a NULL byte. How do you create a file with a name that contains a NULL byte? -- Grant E

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Ian
On Oct 14, 10:30 pm, Lawrence D'Oliveiro wrote: > In message , Rhodri James wrote: > > > ... frankly putting arbitrary binary into a literal string is rather > > asking for something like this to come and bite you. > > It normally works fine on sensible OSes. Which OSes would those be? It doesn'

Re: open() throws permission error and I don't get why

2010-10-15 Thread Nobody
On Fri, 15 Oct 2010 10:52:53 -0500, Andy Theuninck wrote: > I'm trying to write a script to read e-mail over stdin, extract > attachments, and distribute them around the file system based on the > incoming e-mail address. > > Everything works until I actually try writing interesting file system >

Re: Boolean value of generators

2010-10-15 Thread John Nagle
On 10/14/2010 2:21 PM, Cameron Simpson wrote: On 14Oct2010 14:13, Tim Chase wrote: | On 10/14/10 12:53, Paul Rubin wrote: |>Carl Banks writes: |>>In general, the only way to test if a generator is empty is to try to |>>consume an item. (It's possible to write an iterator that consumes an |>>i

Re: Boolean value of generators

2010-10-15 Thread Grant Edwards
On 2010-10-15, Albert Hopkins wrote: > On Fri, 2010-10-15 at 14:54 +, Grant Edwards wrote: >> > so you could test for emptiness, look ahead at the next item without >> > consuming it, etc. >> >> And what happens when the generator is doing things like executing >> database transactions? > >

open() throws permission error and I don't get why

2010-10-15 Thread Andy Theuninck
I'm trying to write a script to read e-mail over stdin, extract attachments, and distribute them around the file system based on the incoming e-mail address. Everything works until I actually try writing interesting file system locations. I've established, through logging, that postfix runs my sc

Re: processing input from multiple files

2010-10-15 Thread John Posner
On 10/15/2010 6:59 AM, Christopher Steele wrote: Thanks, The issue with the times is now sorted, however I'm running into a problem towards the end of the script: File "sortoutsynop2.py", line 131, in newline = message_type+c+str(station_id)+c+newtime+c+lat+c+lon+c+c+"-"+c+ "002"

Re: Boolean value of generators

2010-10-15 Thread Albert Hopkins
On Fri, 2010-10-15 at 14:54 +, Grant Edwards wrote: > > so you could test for emptiness, look ahead at the next item without > > consuming it, etc. > > And what happens when the generator is doing things like executing > database transactions? You should also add prediction to the caching.

Re: Boolean value of generators

2010-10-15 Thread Grant Edwards
On 2010-10-14, Paul Rubin wrote: > Carl Banks writes: > >> In general, the only way to test if a generator is empty is to try to >> consume an item. (It's possible to write an iterator that consumes >> an item and caches it to be returned on the next next(), and whose >> boolean status indicates

Re: Does everyone keep getting recruiting emails from google?

2010-10-15 Thread Grant Edwards
On 2010-10-15, Philip Semanchuk wrote: > On Oct 14, 2010, at 11:49 AM, Daniel Fetchinson wrote: > >> I keep getting recruiting emails from charlesngu...@google.com about >> working for google as an engineer. > > [...] > > FWIW, I got one email from Charles Nguyen and answered with a "thanks > but

Re: PyCharm

2010-10-15 Thread Jean-Michel Pichavant
Kai Diefenbach wrote: On 2010-10-13 23:36:31 +0200, Robert H said: Since the new IDE from Jetbrains is out I was wondering if "you" are using it and what "you" think about it. It sucks. http://regebro.wordpress.com/2010/10/14/python-ide-code-completion-test Kai You're not serious, this 'b

Re: EOF while scanning triple-quoted string literal

2010-10-15 Thread Steven D'Aprano
On Fri, 15 Oct 2010 17:30:20 +1300, Lawrence D'Oliveiro wrote: > In message , Rhodri James wrote: > >> ... frankly putting arbitrary binary into a literal string is rather >> asking for something like this to come and bite you. > > It normally works fine on sensible OSes. What does it have to d

SQLObject 0.14.1

2010-10-15 Thread Oleg Broytman
Hello! I'm pleased to announce version 0.14.1, a minor bugfix release of branch 0.14 of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be eas

SQLObject 0.13.1

2010-10-15 Thread Oleg Broytman
Hello! I'm pleased to announce version 0.13.1, a minor bugfix release of branch 0.13 of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be eas

Re: How to display unicode char in Windows

2010-10-15 Thread Michel Claveau - MVP
Hi! 1) the good syntax is: # -*- coding: latin-1 -*- print "**" oo = "ö" print "char=<%s>" % oo print "**" 2) in the console (commandLine), use this command: CHCP

How to display unicode char in Windows

2010-10-15 Thread hiral
Hi, I tried... # coding: latin-1 print "**" oo = "ö" print "char=<%s>" % oo print "**" but it is not printing "ö" char; any idea? Thank you. -Hiral -- http://mail.python.org/mailman

Re: Is there any module for automated testing in python?

2010-10-15 Thread Stefan Behnel
gopi krishna, 15.10.2010 12:19: Is there any module for automated testing in python? What kind of "automated testing" do you mean? Generating test cases? Generating test runs from test data? Running unit tests automatically as part of a build? Running tests repeatedly to report changes in tes

Re: processing input from multiple files

2010-10-15 Thread Christopher Steele
Thanks, The issue with the times is now sorted, however I'm running into a problem towards the end of the script: File "sortoutsynop2.py", line 131, in newline = message_type+c+str(station_id)+c+newtime+c+lat+c+lon+c+c+"-"+c+ "002" +c+"-"+c+"-"+c+str(pressure)+c TypeError: canno

Re: Is there any module for automated testing in python?

2010-10-15 Thread James Mills
On Fri, Oct 15, 2010 at 8:19 PM, gopi krishna wrote: > Hi, > Is there any module for automated testing in python? > Pls help me frns.. py.test is quite nice and I use it for my own project(s). The company I work for also uses it to test their software. cheers James -- -- James Mills -- -- "Pr

Is there any module for automated testing in python?

2010-10-15 Thread gopi krishna
Hi, Is there any module for automated testing in python? Pls help me frns.. From Gopi -- http://mail.python.org/mailman/listinfo/python-list

Re: optparser: how to register callback to display binary's help

2010-10-15 Thread hiral
On Oct 13, 6:03 pm, Jean-Michel Pichavant wrote: > hiral wrote: > > Hi, > > > I want to display help message of python script and then display help > > message from the binary file (which also supports -h option): > > > Assumptions: > > 1) 'mybinary' - is linux executable file which supports '-h'

Re: PyCharm

2010-10-15 Thread Kai Diefenbach
On 2010-10-13 23:36:31 +0200, Robert H said: Since the new IDE from Jetbrains is out I was wondering if "you" are using it and what "you" think about it. It sucks. http://regebro.wordpress.com/2010/10/14/python-ide-code-completion-test Kai -- http://mail.python.org/mailman/listinfo/python-

Re: Weird try-except vs if behavior

2010-10-15 Thread Ryan Kelly
On Thu, 2010-10-14 at 22:43 -0700, James Matthews wrote: > Hi, > > I have this code http://gist.github.com/627687 (I don't like pasting > code into the mailing list). Yes, but it makes it harder to discuss the ode and makes the archive that much more useless. It's only a couple of lines, here ya