ANN: Porcupine Web Application Server 0.5.2 is released!

2008-12-05 Thread tkouts
Porcupine Web Application Server is a Python based framework that provides front-to-back revolutionary technologies for building modern data-centric Web 2.0 applications. This release includes the brand new version of QuiX supporting the latest releases of Firefox, Safari and Chrome browsers but

ANN: Shed Skin 0.0.30, an experimental (restricted-)Python-to-C++ Compiler

2008-12-05 Thread Mark Dufour
Hi all, I have just released version 0.0.30 of Shed Skin, an experimental (restricted) Python-to-C++ compiler. Most importantly, this release adds (efficient) support for user-defined classes in generated extension modules, which should make it much easier to integrate compiled code within

How to distribute C/C++ python extension module on Linux?

2008-12-05 Thread Allen
I have build an extension module PyRPC.so (why not be libPyRPC.so?). The PyRPC.so uses API in libRPCPacker.so. How to distribute the PyRPC.so? I just put PyRPC.so and libRPCPacker.so in the same folder. And under this folder, run python. It tells PyRPC module cannot find a method in

Python C API

2008-12-05 Thread googler . 1 . webmaster
Hi :) I have a main() function of my app which intializes the Python Interpreter and some other stuff. When I am finished I call: PyGILState state = PyGILState_Ensure() //call PyRun_String() PyGILStateRelease(state); The first question is, I found out the API contains other commands lik

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Duncan Booth
Lawrence D'Oliveiro [EMAIL PROTECTED] wrote: In message [EMAIL PROTECTED], Duncan Booth wrote: Have you ever considered trying to write readable code instead? (I must admit I haven't checked whether GZipFile works with the 'with' statement... That's why I prefer writing _correct_

Re: How to distribute C/C++ python extension module on Linux?

2008-12-05 Thread David Cournapeau
On Fri, Dec 5, 2008 at 5:09 PM, Allen [EMAIL PROTECTED] wrote: I have build an extension module PyRPC.so (why not be libPyRPC.so?). The PyRPC.so uses API in libRPCPacker.so. How to distribute the PyRPC.so? The simple answer is you can't. Depending on the distribution, the python interpreter is

Re: ANN: New Book: Programming in Python 3

2008-12-05 Thread Dotan Cohen
2008/12/5 Mark Summerfield [EMAIL PROTECTED]: I don't think the book is due in Europe until the end of January, but could take longer for elsewhere. (Of course Israel is in Europe according to the Eurovision Song Contest, so you might get lucky:) Yes, we are in the unique geographical and

Re: CONNECTION TIMED OUT ERROR using urllib2

2008-12-05 Thread svalbard colaco
Hi I set my http_proxy and now i get the following error *urllib2.HTTPError: HTTP Error 403: Forbidden ( The ISA Server denied the specified Uniform Resource Locator (URL). * what other variables have to be set ? Regards, sv On Fri, Dec 5, 2008 at 12:47 PM, rishi pathak [EMAIL

Re: Python C API

2008-12-05 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: The first question is, I found out the API contains other commands lik PyEval_AcquireLock(). I don't really understand if I have to use them too, could anyone explain? Thanks. That's unrelated. The GIL is special in that it has its own handling functions. void

Re: Python C API

2008-12-05 Thread googler . 1 . webmaster
Hi! thats a very interesting point and good to know. I have to release the GIL but how do I do? In this case i need PyEval_AcquireLock and PyEval_ReleaseLock? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

dict subclass and pickle bug (?)

2008-12-05 Thread James Stroud
Hello All, I subclassed dict and overrode __setitem__. When instances are unpickled, the __setstate__ is not called before the keys are assigned via __setitem__ in the unpickling protocol. I googled a bit and found that this a bug filed in 2003: http://bugs.python.org/issue826897 It is

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Steven D'Aprano wrote: On Fri, 05 Dec 2008 13:27:35 +1300, Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Cong Ma wrote: The if ... != None is not necessary... if PatchDatePat.search(f) is OK. I don't do that. Perhaps you should? I prefer

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Steven D'Aprano wrote: ... stupid formatting ... withallthedifferenttermsruntogetherintoonelinesoyoudon'tknowwhereoneendsandtheotherbeginsifthat'showyouliketowritecodefinethat'snothowIliketodoit -- http://mail.python.org/mailman/listinfo/python-list

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Steven D'Aprano wrote: Since the context has been deleted, it's hard to tell whether the code as written by Lawrence ... If you want to reply to my message, reply to my message, don't reply to my reply to someone else's reply to my message. --

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Duncan Booth wrote: ... but the mess you posted is going to be virtually untestable ... The mess I posted did actually work as written. ... whereas splitting it up into small testable functions will make it much easier for you to actually get somewhere near your

Re: dict subclass and pickle bug (?)

2008-12-05 Thread James Stroud
James Stroud wrote: Hello All, I subclassed dict and overrode __setitem__. When instances are unpickled, the __setstate__ is not called before the keys are assigned via __setitem__ in the unpickling protocol. I googled a bit and found that this a bug filed in 2003:

Re: simplest way to strip a comment from the end of a line?

2008-12-05 Thread eric
On Dec 4, 11:35 pm, Paul McGuire [EMAIL PROTECTED] wrote: Yowza!  My eyes glaze over when I see re's like r'(?m)^(?Pdata.*? (.*?.*?)*)(?:#.*?)?$! yeah, I know ... :( ( I love complicated regexp ... it's like a puzzle game for me) from pyparsing import quotedString, Suppress, restOfLine

Re: using distutils to cross-compile extensions?

2008-12-05 Thread Paul Boddie
On 5 Des, 00:58, David Cournapeau [EMAIL PROTECTED] wrote: The first step for cross compilation would be the ability to build python itself wtih different build/host, and that's already non trivial. Now that Python 3.0 is out, perhaps there will be a possibility of one of the many

ANN: Shed Skin 0.0.30, an experimental (restricted-)Python-to-C++ Compiler

2008-12-05 Thread Mark Dufour
Hi all, I have just released version 0.0.30 of Shed Skin, an experimental (restricted) Python-to-C++ compiler. Most importantly, this release adds (efficient) support for user-defined classes in generated extension modules, which should make it much easier to integrate compiled code within

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Steven D'Aprano
On Fri, 05 Dec 2008 23:28:48 +1300, Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Steven D'Aprano wrote: Since the context has been deleted, it's hard to tell whether the code as written by Lawrence ... If you want to reply to my message, reply to my message, don't reply to

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Steven D'Aprano
On Fri, 05 Dec 2008 23:32:49 +1300, Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Duncan Booth wrote: ... but the mess you posted is going to be virtually untestable ... The mess I posted did actually work as written. ... whereas splitting it up into small testable functions

Re: Python surpasses Perl in popularity?

2008-12-05 Thread Jorgen Grahn
[Followup-To: header set to comp.unix.shell.] On 29 Nov 2008 16:23:49 GMT, Tam Ha [EMAIL PROTECTED] wrote: Jorgen Grahn [EMAIL PROTECTED] wrote: (I could get away with using Bash in these cases. It has functions, local variables and so on. Writing portable Bourne shell is not as much fun.)

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Steven D'Aprano
On Fri, 05 Dec 2008 23:16:08 +1300, Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Steven D'Aprano wrote: On Fri, 05 Dec 2008 13:27:35 +1300, Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Cong Ma wrote: The if ... != None is not necessary... if

i use the urllib question

2008-12-05 Thread Huytason
i use pthon 3.0 today python code: import urllib.request then use PyRun_StringFlag to run it. get this class ImportError it's a bug? -- http://mail.python.org/mailman/listinfo/python-list

Re: generating a liste of characters

2008-12-05 Thread Mark Tolonen
Yves Dorfsman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there any built in way to generate a list of characters, something along the line of range('a'-'z') ? Right now I am using: chars = [ chr(l) for l in range(0x30, 0x3a) ] # 0 - 9 chars += [ chr(l) for l in

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Marco Mariani
Steven D'Aprano wrote: Gosh Lawrence, do tell, which category do YOU fall into? I suppose a mix-up between a cowbody (or Fonzie) coder and a troll. His programs have an inner poetry that we're obviously too stupid to understand. -- http://mail.python.org/mailman/listinfo/python-list

Re: generating a liste of characters

2008-12-05 Thread bearophileHUGS
Mark Tolonen: Writing a helper function reduces code repetition and improves readability:     def crange(startch,endch):         '''Return a list of characters from startch to endch, inclusive.'''         return [chr(c) for c in xrange(ord(startch),ord(endch)+1)] In Python ranges are open on

Re: RELEASED Python 2.6.1

2008-12-05 Thread malkarouri
On 5 Dec, 05:07, Barry Warsaw [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hot on the heals of Python 3.0 comes the Python 2.6.1 bug-fix   release. Nice work. Thanks. Source tarballs and Windows installers can be downloaded from the   Python 2.6.1 page I note

Re: ANN: Shed Skin 0.0.30, an experimental (restricted-)Python-to-C++ Compiler

2008-12-05 Thread Paul Boddie
On 5 Des, 12:24, Mark Dufour [EMAIL PROTECTED] wrote: Hi all, I have just released version 0.0.30 of Shed Skin, an experimental (restricted) Python-to-C++ compiler. I think Mark forgot to post some links. ;-) http://shed-skin.blogspot.com/ http://code.google.com/p/shedskin/ Paul --

Re: generating a liste of characters

2008-12-05 Thread Mark Tolonen
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Mark Tolonen: Writing a helper function reduces code repetition and improves readability: def crange(startch,endch): '''Return a list of characters from startch to endch, inclusive.''' return [chr(c) for c in

Re: pretty strange behavior of strip

2008-12-05 Thread Guy Doune
Ok, didn't show the whole problem... I will read the doc anyway, but why questions.html keep it t?? test=['03.html', '06.html', 'questions.html', '04.html', 'toc.html', '01.html', '05.html', '07.html', '02.html', '08.html'] test[4] 'toc.html' test[4].strip('.html') 'oc'

Re: EBCDIC -- ASCII

2008-12-05 Thread Michael Ströder
[EMAIL PROTECTED] wrote: On Dec 4, 4:45 pm, Michael Ströder [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I'm having a problem trying to use the codecs package to aid me in converting some bytes from EBCDIC into ASCII. Which EBCDIC variant? sEBCDIC = unicode(sSource, 'cp500', 'ignore')

A more pythonic way of writting

2008-12-05 Thread eric
Hi, I've got this two pieces of code that works together, and fine def testit(): for vals in [[imask==mask for mask in [1j for j in range(6)] ] for i in range(16)]: print vals, '-', flag(*vals) def flag(IGNORECASE=False, LOCALE=False, MULTILINE=False, DOTALL=False, UNICODE=False,

Re: generating a liste of characters

2008-12-05 Thread Duncan Booth
Mark Tolonen [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] .. In Python ranges are open on the right, so I name cinterval such function. Yes, and that's fine when dealing with integers and slicing, but when dealing with characters, it is non-obvious

Re: pretty strange behavior of strip FORGET THE LAST ONE

2008-12-05 Thread Guy Doune
Guy Doune a écrit : Ok, didn't show the whole problem... I will read the doc anyway, but why questions.html keep it t?? test=['03.html', '06.html', 'questions.html', '04.html', 'toc.html', '01.html', '05.html', '07.html', '02.html', '08.html'] test[4] 'toc.html' test[4].strip('.html')

Python 3.0 automatic decoding of UTF16

2008-12-05 Thread Johannes Bauer
Hello group, I'm having trouble reading a utf-16 encoded file with Python3.0. This is my (complete) code: #!/usr/bin/python3.0 class AddressBook(): def __init__(self, filename): f = open(filename, r, encoding=utf16) while True:

Re: A more pythonic way of writting

2008-12-05 Thread Mark Tolonen
eric [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] def flag(IGNORECASE=False, LOCALE=False, MULTILINE=False, DOTALL=False, UNICODE=False, VERBOSE=False): vals = [IGNORECASE, LOCALE, MULTILINE, DOTALL, UNICODE, VERBOSE] filtered = map( lambda m:m[1],filter( lambda m: m[0],

Re: pretty strange behavior of strip

2008-12-05 Thread Mark Tolonen
Guy Doune [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Ok, didn't show the whole problem... I will read the doc anyway, but why questions.html keep it t?? test=['03.html', '06.html', 'questions.html', '04.html', 'toc.html', '01.html', '05.html', '07.html', '02.html',

mod_python and files directory

2008-12-05 Thread mete bilgin
Hi all, I try to make a websevice with python and mod_python. İ try to make a po files, but i can not reach them in the page. When i ask the page like os.listdir('.') but i want to get files directory, what can i do? sorry for my bad describe of that. Thanks a lot... --

ftp retrlines with re...

2008-12-05 Thread isabellkna...@googlemail.com
Hey! Ive been working on an application quite some time now and i wanted to include something to let the user load a new version. i therefore tried to include this here: from ftplib import FTP import string,re def handleDownload(block): processfile.write(block) print ., def

Small problem with Psyco

2008-12-05 Thread bearophileHUGS
I post it here because I am using a Psyco version that was compiled by people here. I am using Python 2.6.1, on Win, with Psyco (1, 6, 0, 'final', 0). This minimized code: from psyco.classes import psyobj class Bar(psyobj): def __init__(self, baz): pass b = Bar(0) Produces:

Re: Running Python 2 and Python 3 on the same machine

2008-12-05 Thread Paul Watson
On Fri, 2008-12-05 at 02:10 +0100, Martin v. Löwis wrote: Since the source code is incompatible, I was expecting the Python executable to have a new name such as 'python3' It does: the executable is called python3.0. or for the default source code filename to change to '.py3' or

Re: RELEASED Python 3.0 final

2008-12-05 Thread bearophileHUGS
Andreas Waldenburger: Whenever has it been a pythonic ideal to not allow stuff? You get warnings. Everything else is up to you. It's a strong source for bugs, especially for newbies, that I have hoped to see removed from Python3 (my first request of this was years ago). I was nearly sure to see

Re: as keyword woes

2008-12-05 Thread Andreas Waldenburger
On 04 Dec 2008 22:29:41 GMT Steven D'Aprano [EMAIL PROTECTED] wrote: Thank goodness we don't have to program in verbose, explicit English! Then you'll HATE Inform 7: http://en.wikipedia.org/wiki/Inform_7#Example_game_2 :) /W -- My real email address is constructed by swapping the domain with

Re: Small problem with Psyco

2008-12-05 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: I post it here because I am using a Psyco version that was compiled by people here. I am using Python 2.6.1, on Win, with Psyco (1, 6, 0, 'final', 0). This minimized code: from psyco.classes import psyobj class Bar(psyobj): def __init__(self, baz):

Re: pretty strange behavior of strip

2008-12-05 Thread rdmurray
On Thu, 4 Dec 2008 at 20:54, Terry Reedy wrote: 'toc.html' test[4].strip('.html') 'oc' Can't figure out what is going on, really. What I can't figure out is why, when people cannot figure out what is going on with a function (or methods in this case), they do not look it up the doc.

Re: A more pythonic way of writting

2008-12-05 Thread Gerard flanagan
eric wrote: Hi, I've got this two pieces of code that works together, and fine def testit(): for vals in [[imask==mask for mask in [1j for j in range(6)] ] for i in range(16)]: print vals, '-', flag(*vals) def flag(IGNORECASE=False, LOCALE=False, MULTILINE=False, DOTALL=False,

Re: RELEASED Python 3.0 final

2008-12-05 Thread Andreas Waldenburger
On Thu, 4 Dec 2008 15:49:46 -0600 [EMAIL PROTECTED] wrote: Andreas Whenever has it been a pythonic ideal to not allow Andreas stuff? You get warnings. Everything else is up to you. It's more than warnings. With properly crafted combinations of spaces and tabs you can get code

Re: To Troll or Not To Troll (aka: as keyword woes)

2008-12-05 Thread Andreas Waldenburger
On Thu, 4 Dec 2008 16:17:20 -0800 Warren DeLano [EMAIL PROTECTED] wrote: Thank so much for the suggestions Ben. Sorry that I am personally unable to live up to your high standards, but it is nevertheless an honor to partipicate in such a helpful and mutually respectful community mailing

[no subject]

2008-12-05 Thread Fred
-- http://mail.python.org/mailman/listinfo/python-list

Re: A more pythonic way of writting

2008-12-05 Thread eric
On Dec 5, 3:44 pm, Mark Tolonen [EMAIL PROTECTED] wrote: eric [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] def flag(IGNORECASE=False, LOCALE=False, MULTILINE=False, DOTALL=False, UNICODE=False, VERBOSE=False):    vals = [IGNORECASE, LOCALE, MULTILINE, DOTALL, UNICODE,

Re: RELEASED Python 3.0 final

2008-12-05 Thread bearophileHUGS
Andreas Waldenburger: My point is: If you mix tabs and spaces in a way that breaks code, you'll find out pretty easily, because your program will not work. - Most newbies don't know that. - Sometimes it may produce wrong results. - And even if you are an expert when you go changing a little a

Re: Switching windows in PyQT

2008-12-05 Thread ShanMayne
On Dec 3, 8:12 pm, Дамјан Георгиевски [EMAIL PROTECTED] wrote: I am new to PyQT and GUI programming in general. What tutorials I have found are relatively clear on standard operations within a single window (QtGui.QWidget or QtGui.QMainWindow). Exiting this window exits the overall

Re: pretty strange behavior of strip

2008-12-05 Thread Mark Tolonen
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thu, 4 Dec 2008 at 20:54, Terry Reedy wrote: [snip] I have often wished that in 'split' I could specify a _set_ of characters on which the string would be split, in the same way the default list of whitespace characters causes a

Re: Mathematica 7 compares to other languages

2008-12-05 Thread Xah Lee
On Dec 4, 6:09 pm, [EMAIL PROTECTED] wrote: For the interested, with MMA 6, on a Pentium 4 3.8Ghz: The code that Jon posted: Timing[Export[image-jon.pgm, [EMAIL PROTECTED]@Main[2, 100, 4]]] {80.565, image-jon.pgm} The code that Xah posted: Timing[Export[image-xah.pgm, [EMAIL

Re: pretty strange behavior of strip

2008-12-05 Thread MRAB
[EMAIL PROTECTED] wrote: On Thu, 4 Dec 2008 at 20:54, Terry Reedy wrote: 'toc.html' test[4].strip('.html') 'oc' Can't figure out what is going on, really. What I can't figure out is why, when people cannot figure out what is going on with a function (or methods in this case), they do

Re: To Troll or Not To Troll (aka: as keyword woes)

2008-12-05 Thread Michael Mabin
Warren, weren't you aware that Python.org is now a church. So you can never live up to the standards of the Pythonista high priests. You can only ask a question or submit your comment then cower, hoping the pythonista high priests don't beat you with clubs for heresy. ;) 2008/12/4 Warren

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread George Sakkis
On Dec 5, 8:06 am, Marco Mariani [EMAIL PROTECTED] wrote: Steven D'Aprano wrote: Gosh Lawrence, do tell, which category do YOU fall into? I suppose a mix-up between a cowbody (or Fonzie) coder and a troll. Naah.. more likely an (ex?) Lisper/Schemer. --

Re: pretty strange behavior of strip

2008-12-05 Thread rdmurray
On Fri, 5 Dec 2008 at 07:54, Mark Tolonen wrote: import re re.split('[,.]','blah,blah.blah') ['blah', 'blah', 'blah'] Thank you. Somehow it never occurred to me that I could use that kind of pattern that way. I guess my brain just doesn't think in regexes very well :) --RDM --

Re: simplest way to strip a comment from the end of a line?

2008-12-05 Thread eric
On Dec 5, 11:56 am, eric [EMAIL PROTECTED] wrote: On Dec 4, 11:35 pm, Paul McGuire [EMAIL PROTECTED] wrote: Yowza!  My eyes glaze over when I see re's like r'(?m)^(?Pdata.*? (.*?.*?)*)(?:#.*?)?$! yeah, I know ... :( ( I love complicated regexp ... it's like a puzzle game for me) from

Whitespace in Python (3) [was: RELEASED Python 3.0 final]

2008-12-05 Thread Andreas Waldenburger
On Fri, 5 Dec 2008 07:46:02 -0800 (PST) [EMAIL PROTECTED] wrote: Andreas Waldenburger: My point is: If you mix tabs and spaces in a way that breaks code, you'll find out pretty easily, because your program will not work. - Most newbies don't know that. - Sometimes it may produce wrong

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread J Kenneth King
Johannes Bauer [EMAIL PROTECTED] writes: Traceback (most recent call last): File ./modify.py, line 12, in module a = AddressBook(2008_11_05_Handy_Backup.txt) File ./modify.py, line 7, in __init__ line = f.readline() File /usr/local/lib/python3.0/io.py, line 1807, in readline

Re: pretty strange behavior of strip FORGET THE LAST ONE

2008-12-05 Thread Scott David Daniels
Guy Doune wrote: Guy Doune a écrit : Ok, didn't show the whole problem... I will read the doc anyway, but why questions.html keep it t?? test=['03.html', '06.html', 'questions.html', '04.html', 'toc.html', '01.html', '05.html', '07.html', '02.html', '08.html'] test[4] 'toc.html'

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread Johannes Bauer
J Kenneth King schrieb: It probably means what it says: that the input file contains characters it cannot read using the specified encoding. No, it doesn't. The file is just fine, just as the example. Are you generating the file from python using a file object with the same encoding? If

Re: ANN: Shed Skin 0.0.30, an experimental (restricted-)Python-to-C++ Compiler

2008-12-05 Thread Scott David Daniels
Mark Dufour wrote: Hi all, I have just released version 0.0.30 of Shed Skin, ... Normally, including a link is a good idea. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: RELEASED Python 3.0 final

2008-12-05 Thread Peter Pearson
On Thu, 4 Dec 2008 15:49:46 -0600, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: It's more than warnings. With properly crafted combinations of spaces and tabs you can get code which looks like it has a certain indentation to the human observer but which looks like it has different indentation

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread Richard Brodie
J Kenneth King [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] It probably means what it says: that the input file contains characters it cannot read using the specified encoding. That was my first thought. However it appears that there is an off by one error somewhere in the

etree, minidom unicode

2008-12-05 Thread n00b
hi, i have a feew questions concnering unicode and utf-8 handling and would appreciate any insights. 1) i got a xml document, utf-8, encoded and been trying to use etree to parse and then commit to mysql db. using etree, everything i've been extracting is return as a string except ascii char

Re: dict subclass and pickle bug (?)

2008-12-05 Thread Terry Reedy
James Stroud wrote: James Stroud wrote: Hello All, I subclassed dict and overrode __setitem__. When instances are unpickled, the __setstate__ is not called before the keys are assigned via __setitem__ in the unpickling protocol. I googled a bit and found that this a bug filed in 2003: It

Re: RELEASED Python 3.0 final

2008-12-05 Thread Terry Reedy
[EMAIL PROTECTED] wrote: Andreas Waldenburger: Whenever has it been a pythonic ideal to not allow stuff? You get warnings. Everything else is up to you. It's a strong source for bugs, especially for newbies, that I have hoped to see removed from Python3 (my first request of this was years

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread Terry Reedy
Johannes Bauer wrote: Hello group, I'm having trouble reading a utf-16 encoded file with Python3.0. This is my (complete) code: what OS. This is often critical when you have a problem interacting with the OS. #!/usr/bin/python3.0 class AddressBook(): def __init__(self,

pytz and timezone specialists

2008-12-05 Thread manatlan
Here is a really simple code : --- from datetime import datetime from pytz import timezone tz=timezone(Europe/Paris) d=datetime(2008,12,12,19,00,00,tzinfo=tz) print d.isoformat() d=datetime.now(tz) print d.isoformat()

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread Johannes Bauer
Terry Reedy schrieb: Johannes Bauer wrote: Hello group, I'm having trouble reading a utf-16 encoded file with Python3.0. This is my (complete) code: what OS. This is often critical when you have a problem interacting with the OS. It's a 64-bit Linux, currently running: Linux joeserver

Overwrite single line of file

2008-12-05 Thread chrispoliquin
Hi, I have about 900 text files (about 2 GB of data) and I need to make some very specific changes to the last line of each file. I'm wondering if there is a way to just overwrite the last line of a file or replace the spots I want (I even know the position of the characters I need to replace).

slow Python 3.0 write performance?

2008-12-05 Thread Istvan Albert
Could someone run the code below on both Python 2.5 and 3.0 For me (on Windows) it runs over 7 times slower with Python 3.0 import time lo, hi, step = 10**5, 10**6, 10**5 # writes increasingly more lines to a file for N in range(lo, hi, step): fp = open('foodata.txt', 'wt') start =

Re: slow Python 3.0 write performance?

2008-12-05 Thread Benjamin Kaplan
On Fri, Dec 5, 2008 at 1:54 PM, Istvan Albert [EMAIL PROTECTED]wrote: Could someone run the code below on both Python 2.5 and 3.0 For me (on Windows) it runs over 7 times slower with Python 3.0 import time lo, hi, step = 10**5, 10**6, 10**5 # writes increasingly more lines to a file for

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread Joe Strout
On Dec 5, 2008, at 11:36 AM, Johannes Bauer wrote: I suspect that '?' after \n (\u0a00) is indicates not 'question-mark' but 'uninterpretable as a utf16 character'. The traceback below confirms that. It should be an end-of-file marker and should not be passed to Python. I strongly suspect

Re: Overwrite single line of file

2008-12-05 Thread MRAB
[EMAIL PROTECTED] wrote: Hi, I have about 900 text files (about 2 GB of data) and I need to make some very specific changes to the last line of each file. I'm wondering if there is a way to just overwrite the last line of a file or replace the spots I want (I even know the position of the

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread info
On Dec 5, 3:25 pm, Johannes Bauer [EMAIL PROTECTED] wrote: Hello group, I'm having trouble reading a utf-16 encoded file with Python3.0. This is my (complete) code: #!/usr/bin/python3.0 class AddressBook():         def __init__(self, filename):                 f = open(filename, r,

Re: slow Python 3.0 write performance?

2008-12-05 Thread Mike Driscoll
On Dec 5, 12:54 pm, Istvan Albert [EMAIL PROTECTED] wrote: Could someone run the code below on both Python 2.5 and 3.0 For me (on Windows) it runs over 7 times slower with Python 3.0 import time lo, hi, step = 10**5, 10**6, 10**5 # writes increasingly more lines to a file for N in

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread MRAB
Joe Strout wrote: On Dec 5, 2008, at 11:36 AM, Johannes Bauer wrote: I suspect that '?' after \n (\u0a00) is indicates not 'question-mark' but 'uninterpretable as a utf16 character'. The traceback below confirms that. It should be an end-of-file marker and should not be passed to Python. I

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Aaron Brady
On Dec 5, 4:32 am, Lawrence D'Oliveiro [EMAIL PROTECTED] central.gen.new_zealand wrote: The code people write is probably a direct reflection of their thinking processes: For example, slow, plodding, one step at a time, incapable of imaginative leaps, versus those who operate directly on larger

Re: pytz and timezone specialists

2008-12-05 Thread Ned Deily
In article [EMAIL PROTECTED], manatlan [EMAIL PROTECTED] wrote: Here is a really simple code : --- from datetime import datetime from pytz import timezone tz=timezone(Europe/Paris) d=datetime(2008,12,12,19,00,00,tzinfo=tz) print

Re: slow Python 3.0 write performance?

2008-12-05 Thread Bruno Desthuilliers
Istvan Albert a écrit : Could someone run the code below on both Python 2.5 and 3.0 For me (on Windows) it runs over 7 times slower with Python 3.0 Already covered, I think: http://groups.google.com/group/comp.lang.python/browse_frm/thread/9046eee09137c657# import time lo, hi, step =

Problems running on hp duo Pentium R processor

2008-12-05 Thread jim-on-linux
Python help, In September I wrote: I have a number of clients running a program built with python 2.5. One has just purchased an HP with a duo core Pentium R processor E2200, 2.2G with .99g ram. Only on the new HP, when they try to print they get an import error; File win32ui.pyc line 12, in

Centralized logging server...

2008-12-05 Thread Sam
Hi... I'm working with a small team writing a bunch of python applications that communicate via xml/http in a somewhat restful way. :) They are running on about half a dozen computers. We'll probably be scaling that to a lot more computers soon. I've been playing with the python logging

Re: slow Python 3.0 write performance?

2008-12-05 Thread skip
Istvan Could someone run the code below on both Python 2.5 and 3.0 For Istvan me (on Windows) it runs over 7 times slower with Python 3.0 ... I/O was completely rewritten for Python 3.0. Stdio is no longer used. At the moment I believe much of the io subsystem is still implemented

Re: RELEASED Python 3.0 final

2008-12-05 Thread Fernando H. Sanches
On Dec 4, 5:45 pm, Andreas Waldenburger [EMAIL PROTECTED] wrote: On Thu, 4 Dec 2008 11:52:38 -0600 [EMAIL PROTECTED] wrote:     As you have probably guessed: nothing changed here.     Also see:http://www.python.org/dev/peps/pep-0666/     What? Do you mean it's possible to mix tabs

Re: slow Python 3.0 write performance?

2008-12-05 Thread Istvan Albert
On Dec 5, 3:06 pm, [EMAIL PROTECTED] wrote: It should get faster over time.  It will get faster over a shorter period of time if people contribute patches. I see, thanks for the clarification. I will make the point though that this makes python 3.0 unsuited for anyone who has to process data.

Re: Centralized logging server...

2008-12-05 Thread skip
Sam I've been playing with the python logging module. I'd like all of Sam these applications to write their logs to the same place in order Sam to make analysis easier. Sam Any ideas on best practices? Perhaps use logging.handlers.SysLogHandler? Sam What are my options for

Re: Problems running on hp duo Pentium R processor

2008-12-05 Thread Kevin Kelley
If they are running standard Win XP (Home or Pro), as opposed to 64-bit Win XP, then whether or not the CPU supports the IA64 instruction set really doesn't matter. As far as I know every Intel Core2 and Pentium Dual-Core CPU since ~ 2006 has supported 64bit instructions, even the Atom is 64bit.

Re: Overriding a method at the instance level on a subclass of a builtin type

2008-12-05 Thread Arnaud Delobelle
Arnaud Delobelle [EMAIL PROTECTED] writes: Zac Burns [EMAIL PROTECTED] writes: Ok. Feature request then - assignment of a special method name to an instance raises an error. I haven't got the time to implement it, but I'm sure you can obtain the behaviour you want. OK I've had half an

Re: slow Python 3.0 write performance?

2008-12-05 Thread Christian Heimes
Istvan Albert wrote: I see, thanks for the clarification. I will make the point though that this makes python 3.0 unsuited for anyone who has to process data. One could live with slowdowns of say 20-50 percent, to get the goodies that 3.0 offers, but when a process that takes 1 second suddenly

Re: RELEASED Python 3.0 final

2008-12-05 Thread Andreas Waldenburger
On Fri, 5 Dec 2008 12:16:47 -0800 (PST) Fernando H. Sanches [EMAIL PROTECTED] wrote: On Dec 4, 5:45 pm, Andreas Waldenburger [EMAIL PROTECTED] wrote: On Thu, 4 Dec 2008 11:52:38 -0600 [EMAIL PROTECTED] wrote: [snip] Whenever has it been a pythonic ideal to not allow stuff? You get

Can I load a python program at the interactive prompt?

2008-12-05 Thread walterbyrd
I am running cygwin on xp. Much to my annoyance, I can not cut-and-paste from a windows app to the python prompt. I think I could do this with putty, but I do not have the permissions to install putty on my xp box. Can I load a file into the python interactive environment? For example I have a

Re: slow Python 3.0 write performance?

2008-12-05 Thread MRAB
Istvan Albert wrote: On Dec 5, 3:06 pm, [EMAIL PROTECTED] wrote: It should get faster over time. It will get faster over a shorter period of time if people contribute patches. I see, thanks for the clarification. I will make the point though that this makes python 3.0 unsuited for anyone

Re: Can I load a python program at the interactive prompt?

2008-12-05 Thread Tim Golden
walterbyrd wrote: I am running cygwin on xp. Much to my annoyance, I can not cut-and-paste from a windows app to the python prompt. I think I could do this with putty, but I do not have the permissions to install putty on my xp box. I do this all the time. The key (altho' not strictly

Re: Problems running on hp duo Pentium R processor

2008-12-05 Thread jim-on-linux
On Friday 05 December 2008 15:27, Kevin Kelley wrote: If they are running standard Win XP (Home or Pro), as opposed to 64-bit Win XP, then whether or not the CPU supports the IA64 instruction set really doesn't matter. As far as I know every Intel Core2 and Pentium Dual-Core CPU since ~ 2006

Re: Can I load a python program at the interactive prompt?

2008-12-05 Thread Tim Golden
walterbyrd wrote: I am running cygwin on xp. and I just noticed this vital bit. So not sure how much of my other post applies. Sorry. Maybe it'll help anyway. :) TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I load a python program at the interactive prompt?

2008-12-05 Thread Brian Blais
On Dec 5, 2008, at 15:52 , walterbyrd wrote: Can I load a file into the python interactive environment? For example I have a file called test.py that consists of the following: print hello print hello again Can I load that file into python at the prompt? load test.py or something like

  1   2   3   >