Re: utf8 and ftplib

2005-06-20 Thread Richard Lewis
OK, I'm still not getting this unicode business. Given this document: == aàáâã eèéêë iìíîï oòóôõ oùúûü == (If testing, make sure you save this as utf-8 encoded.) and this Python script: == import sys f

Re: utf8 and ftplib

2005-06-20 Thread Richard Lewis
On Mon, 20 Jun 2005 12:37:42 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > [SNIP] Just add to this: my input document was written using character references rather than literal characters (as was the sample output document). However, I've just noticed that my mail cl

Re: utf8 and ftplib

2005-06-20 Thread Richard Lewis
On Mon, 20 Jun 2005 14:27:17 +0200, "Fredrik Lundh" <[EMAIL PROTECTED]> said: > > well, you're messing it up all by yourself. getting rid of all the > codecs and > unicode2charrefs nonsense will fix this: > Thanks for being so patient and understanding. OK, I've taken it all out. The only think

Re: Python choice of database

2005-06-20 Thread Richard Lewis
On Mon, 20 Jun 2005 15:18:58 GMT, "Philippe C. Martin" <[EMAIL PROTECTED]> said: > Hi, > > I am looking for a stand-alone (not client/server) database solution for > Python. > > 1) speed is not an issue > 2) I wish to store less than 5000 records > 3) each record should not be larger than 16K >

Re: Python can do it for me?

2005-06-21 Thread Richard Lewis
On 21 Jun 2005 06:51:16 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> said: > Really? I see Python is very good general-purpose language. I studing > TCL, C++ and Java too. > > And remote conection? Do you know something? > You mean connecting to a database from a remote machine? Most (probabl

Tkinter grid layout

2005-07-06 Thread Richard Lewis
Hi there, I've got a tree control in Tkinter (using the ESRF Tree module) but I can't get it to layout how I want it. I'd like to have it so that it streches north/south (anchored to the top and bottom), is of a fixed width and is anchored to the left hand side. Here's my code (its derived from o

Re: Tkinter grid layout

2005-07-06 Thread Richard Lewis
On Wed, 06 Jul 2005 11:44:55 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > Hi there, > > I've got a tree control in Tkinter (using the ESRF Tree module) but I > can't get it to layout how I want it. > > I'd like to have it so that it strec

Re: Tkinter grid layout

2005-07-06 Thread Richard Lewis
On Wed, 06 Jul 2005 17:36:01 +0200, "Eric Brunel" <[EMAIL PROTECTED]> said: > On Wed, 06 Jul 2005 11:44:55 +0100, Richard Lewis > <[EMAIL PROTECTED]> wrote: > > > Hi there, > > > > I've got a tree control in Tkinter (using the ESRF Tree

Re: Tkinter grid layout

2005-07-06 Thread Richard Lewis
On Wed, 06 Jul 2005 16:32:42 GMT, "William Gill" <[EMAIL PROTECTED]> said: > Excuse me for intruding, but I followed examples and ended up with a > similar architecture: > > from Tkinter import * > class MyMain(Frame): > def __init__(self, master): > self.root = m

DOM text

2005-08-26 Thread Richard Lewis
Hello Pythoners, I'm currently writing some Python to manipulate a semi-structured XML document. I'm using DOM (minidom) and I've got working code for transforming the document to HTML files and for adding the 'structured' elements which populate the higher regions of the tree (i.e. near the root)

Re: DOM text

2005-08-26 Thread Richard Lewis
On Fri, 26 Aug 2005 12:13:10 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]> said: > Richard Lewis wrote: > > > > I admit I haven't tried very much code yet, but I'm not sure how I'm > > going to handle situations like: the user wants to inser

Re: DOM text

2005-08-26 Thread Richard Lewis
On Fri, 26 Aug 2005 13:59:09 +0200, "Fredrik Lundh" <[EMAIL PROTECTED]> said: > Robert Kern wrote: > > > You might find that the more Pythonic XML modules are better suited to > > handling mixed content. I've been using lxml and ElementTree quite > > successfully. > > fwiw, here's an ET snippet

Re: Problem with Pythoncard

2005-08-26 Thread Richard Lewis
On Fri, 26 Aug 2005 20:51:15 +0530, "Varun Hiremath" <[EMAIL PROTECTED]> said: > Hello everybody, > I was trying to install pythoncard on my system and I got this > error. I am using an unstable version of Debian. Can someone tell me > what the error could be. Is it because I am usingUnstabl

Re: problems with tarfile.open and tar.bz2

2005-08-26 Thread Richard Lewis
On 26 Aug 2005 09:05:29 -0700, [EMAIL PROTECTED] said: > Hello everyone, > > I need some tar functionality for my program. Currently the following > code properly displays tar archives, and tar.gz archives. However, it > chokes on tar.bz2 archives with the following error: > > File "mail_fil

Re: ideas for university project ??

2005-08-27 Thread Richard Lewis
On Fri, 26 Aug 2005 11:49:34 +0100, "Jon Hewer" <[EMAIL PROTECTED]> said: > > Areas of interested include AI, distributed systems. Have you considered looking at Semantic Web stuff? Its all still experimental but its quite AI and very distributed. Cheers, Richard -- http://mail.python.org/mailm

Re: Dynamic image creation for the web...

2005-08-28 Thread Richard Lewis
On Sun, 28 Aug 2005 09:50:17 + (UTC), "Tompa" <[EMAIL PROTECTED]> said: > Hi, > > I would like to create images on the fly as a response to an http > request. > I can do this with PIL like this (file create_gif.py): > from PIL import Image, ImageDraw > > print 'Status: 200 OK' > print 'Conte

Re: DOM text

2005-08-30 Thread Richard Lewis
On Fri, 26 Aug 2005 11:43:18 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > > I'm implementing a Cursor class now which keeps track of the current > parent Element, text node and character position so that I can easily (I > hope ;-) work out where the split

Re: DOM text

2005-08-30 Thread Richard Lewis
On Tue, 30 Aug 2005 11:17:25 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > > Here is the *complete* code for my SectionCursor class: In case anyone's interested, I've just noticed a logical error in the next_node() method: ===

Re: DOM text

2005-08-30 Thread Richard Lewis
On Tue, 30 Aug 2005 12:05:38 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > > On Tue, 30 Aug 2005 11:17:25 +0100, "Richard Lewis" > <[EMAIL PROTECTED]> said: > > > > Here is the *complete* code for my SectionCursor class: > > In

DOM question

2005-06-02 Thread Richard Lewis
Hi there, I have an XML document which contains a mixture of structural nodes (called 'section' and with unique 'id' attributes) and non-structural nodes (called anything else). The structural elements ('section's) can contain, as well as non-structural elements, other structural elements. I'm doi

Re: DOM question

2005-06-02 Thread Richard Lewis
On Thu, 02 Jun 2005 14:34:47 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]> said: > > However, I got exactly the same problem: each time I use this function I > > just get a DOM Text node with a few white space (tabs and returns) in > > it. I guess this is the indentation in my source document? But

Re: Two questions

2005-06-02 Thread Richard Lewis
On 2 Jun 2005 06:45:18 -0700, [EMAIL PROTECTED] said: > Hi, > > I've developed in several other languages and have recently found > Python and I'm trying to use it in the shape of the PythonCard > application development tool. > > My two questions: > > 1. What is the easiest way to create a for

minidom Node to Element

2005-06-03 Thread Richard Lewis
Hey, Can I convert an xml.dom.Node object to an xml.dom.Element object? I want to do the conversion inside a condition like this: if node.nodeType == Node.ELEMENT_NODE: # do conversion: element = Element(node) element = node.toElement() so it definitely won't cause problems. I just c

Re: minidom Node to Element

2005-06-03 Thread Richard Lewis
Hang on! It *knows*! Wow, you can call getElementsByTagName() on a Node object and it does the right thing. Weird, but I like it! Very Python! R. On Fri, 03 Jun 2005 17:07:37 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > Hey, > > Can I convert an xml.dom.Node obj

Tkinter app structure

2005-06-13 Thread Richard Lewis
Hi there, I've just started my first project with Tkinter. I've already coded all the data handling classes and have a nice interface to work with (it happens to be a wrapper around the DOM of a large(ish) XML document but thats probably not important ;-) I'm new to Tkinter so I've started in a

Re: Tkinter app structure

2005-06-13 Thread Richard Lewis
On Mon, 13 Jun 2005 16:45:11 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > > Whats going wrong? Is it a 'circular import'? Is there a better way that > I could organise these modules? > I've got a hack which I'm not happy with: I've go

Re: windows directory

2005-06-14 Thread Richard Lewis
On Tue, 14 Jun 2005 15:32:02 +0800, "Austin" <[EMAIL PROTECTED]> said: > I would like to write a program which creates the folders in specific > directory. > For example, I want to create folder in Program Files. How do I know > which > is in C:\ or D:\ > Is there any function to get the active pat

Resume after exception

2005-06-14 Thread Richard Lewis
Hi there, Is it possible to have an 'except' case which passes control back to the point after the exception occurred? e.g. # a function to open the file # raises FileLockedException is file contains 'locked' information def open_file(file_name): f = file(file_name, 'r') {read first line

Re: Resume after exception

2005-06-14 Thread Richard Lewis
On Tue, 14 Jun 2005 10:09:30 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > Hi there, > > Is it possible to have an 'except' case which passes control back to the > point after the exception occurred? > > e.g. > > # a function to op

utf8 and ftplib

2005-06-16 Thread Richard Lewis
Hi there, I'm having a problem with unicode files and ftplib (using Python 2.3.5). I've got this code: xml_source = codecs.open("foo.xml", 'w+b', "utf8") #xml_source = file("foo.xml", 'w+b') ftp.retrbinary("RETR foo.xml", xml_source.write) #ftp.retrlines("RETR foo.xml", xml_source.write) It op

Re: utf8 and ftplib

2005-06-17 Thread Richard Lewis
On Thu, 16 Jun 2005 12:06:50 -0600, "John Roth" <[EMAIL PROTECTED]> said: > "Richard Lewis" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi there, > > > > I'm having a problem with unicode files and ftplib (using