Re: [Tutor] Python Editors (particualrly Vim)

2005-09-28 Thread Alan Gauld
> 3. scite (very simple) > >All are great and I use all of the three. Just back from vacation or I would have had a lot more to say! :-) But I have to agree with scite as an option, its very lightweight and fast and is basically the editor portion opf Pythonwin(*). That means you get all the edit

Re: [Tutor] Simultaneous Adobe Reader

2005-09-28 Thread Alan Gauld
>From windows, using a python script how can I open > Adobe Reader without displaying a PDF document? Just start the reader executable with no arguments. os.system(r"C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe") Does it for me. If you need to send commands etcto it you propbably nee

Re: [Tutor] Stupid newbie question

2005-09-28 Thread Alan Gauld
>>class startremail: >>def __init__(self): >> remailfile = open('U:\Bounce20.txt', 'r') >> #future >> def getday(self): >> def Read(self,line): >>from startremail import * >>x = startremail() >>print x.getday() >>I get the following return >> >>NameError: name 'getday' is not defi

Re: [Tutor] find data in html file

2005-09-28 Thread Ed Singleton
On 27/09/05, lmac <[EMAIL PROTECTED]> wrote: > Hi there, > i have a base-question. If i want to read some kind of data out of a line > which i know the start-tag and the end-tag in an html-file how do i > recognize > if it's more than one line ? > > Example: > > Some textlinktext . DATA et

Re: [Tutor] [tutor]web development

2005-09-28 Thread Ron Phillips
Well, I won't argue with anyone who chooses otherwise, but CherryPy http://www.cherrypy.org/ is easy to use, lightweight, quick, and pythonic. I write everything as plain old python, then webify it the very last thing.   It's also the basis of a new, promising framework called TurboGears http://

[Tutor] Prevent "Coder's Remorse"?

2005-09-28 Thread Ron Phillips
Maybe it's just me. I am always haunted by "coder's remorse" (the certainty that there's a more compact, beautiful, fun, maintainable way to code anything I finish.) At any rate, I am currently working on a script to model an ordered collection of geographic points, all of which must share the sa

Re: [Tutor] web development

2005-09-28 Thread Kent Johnson
Don Jennings wrote: > what I would really like to know are how people decided to use any > particular framework. Well I stumbled into Jython / Velocity over many years. My first web application was written in Java + servlets using the Jetty servlet engine. At first I didn't use any template eng

Re: [Tutor] script question

2005-09-28 Thread Chris Hallman
Thanks for all the input!!! I really appreciate it. I need to post a correction to my script. What I sent was an early version. I made a few minor modifications: import ConfigParser, string, sys, ossection = sys.argv[1]interface = sys.argv[3]INI=ConfigParser.ConfigParser()INI.read("c:\utils\int

Re: [Tutor] Prevent "Coder's Remorse"?

2005-09-28 Thread Kent Johnson
Ron Phillips wrote: > At any rate, I am currently working on a script to model an ordered > collection of geographic points, all of which must share the same > collection of attributes. So, a little collection might be: > > pointList = [ > {lat:40.123,lon:-81.456, > 'attributes':{'msg':'exam

Re: [Tutor] web development

2005-09-28 Thread Andrew P
I've used CherryPy on a couple of projects now.  I use it with HTMLTemplate (http://freespace.virgin.net/hamish.sanderson/htmltemplate.html) and SQLObject (http://sqlobject.org/). This has the advantage of being about as Pythonic as you can get, since everything you manipulate is represented as a

[Tutor] Prevent "Coder's Remorse"?

2005-09-28 Thread Ron Phillips
Kent Johnson wrote: I'm curious about why you want to do this, it is kind of a strange requirement. Yeah, that was bothering me, too. I was a little unsure if I'd even defined the problem properly; that's what I meant by: "Am I even asking the right questions?" I'll play around with the class

[Tutor] Reformatting a one (long) line xml file

2005-09-28 Thread Negroup -
Hi all, I have an xml file where the tags are all on the same line, without any newline. This file is quite big and difficult to read. I'd like to format it in a convenient way, using indentation and nesting. How to pretty print my content? I hope to have explained well enough my problem, differen

Re: [Tutor] Prevent "Coder's Remorse"?

2005-09-28 Thread Alan G
> pointList = [ > {lat:40.123,lon:-81.456, >'attributes':{'msg':'example','beavers':34, 'distance':18.132} > }, > {lat:40.12345,lon:-81.45678, >'attributes':{'msg':'','beavers':0, 'distance':0.0} > } > ] THis sopunds like its crying out for a class class Point: def __init__(self, lat

Re: [Tutor] Embedding

2005-09-28 Thread Joseph Quigley
Hi, Ok, I'll try to convince them to try python... but still, would it be best to just: Program in C with Python and Java scripts Program in Python with a little bit of C? The game we're trying to make is a Super Mario type game (or super tux for you like linux games). I suppose pygame would mak

Re: [Tutor] script question

2005-09-28 Thread Andrew P
Have you benchmarked it yet?  4000 lines isn't very many, even for an older machine.  Starting the Python interpreter usually takes most of the time with simple scripts like this.  Honestly, benchmark :) You might find it easier to do:: interface_list = INI.items(section)for i in interface_list:

Re: [Tutor] Embedding

2005-09-28 Thread Kent Johnson
Joseph Quigley wrote: > Hi, > Ok, I'll try to convince them to try python... but still, would it be > best to just: > Program in C with Python and Java scripts This seems like a poor choice. Some commercial games have been written with the main game engine in C and Python used to script some gam

Re: [Tutor] web development

2005-09-28 Thread Mike Hansen
> Subject: > [Tutor] web development > From: > Don Jennings <[EMAIL PROTECTED]> > Date: > Tue, 27 Sep 2005 22:13:30 -0400 > To: > tutor@python.org > > To: > tutor@python.org > > > Earlier this month, Kent posted that Jython and Velocity are a good way > to develop dynamic web sites. After a lit

Re: [Tutor] Reformatting a one (long) line xml file

2005-09-28 Thread Christopher Arndt
Negroup - schrieb: > Hi all, I have an xml file where the tags are all on the same line, > without any newline. This file is quite big and difficult to read. I'd > like to format it in a convenient way, using indentation and nesting. > How to pretty print my content? Untested: import sys from xml

Re: [Tutor] Prevent "Coder's Remorse"?

2005-09-28 Thread Danny Yoo
On Wed, 28 Sep 2005, Ron Phillips wrote: > Maybe it's just me. I am always haunted by "coder's remorse" (the > certainty that there's a more compact, beautiful, fun, maintainable way > to code anything I finish.) > > At any rate, I am currently working on a script to model an ordered > collecti

Re: [Tutor] Prevent "Coder's Remorse"?

2005-09-28 Thread Ron Phillips
Ok, I have three diverse answers from three of the tutors that I respect most. Kent Johnson's approach: subclass dict and overloads the __getitem__ , __setitem__, and __delitem__ methods. Alan G's idea: ". . . Get the init method to update a global (or class based) list of instances and writ

Re: [Tutor] Reformatting a one (long) line xml file

2005-09-28 Thread Adam
BeautifulSoup is a brilliant module for this kind of thing. Just make an instance of a parser feed() in the file with file.read() then .prettify()On 28/09/05, Negroup - <[EMAIL PROTECTED]> wrote: Hi all, I have an xml file where the tags are all on the same line,without any newline. This file is qu

Re: [Tutor] Prevent "Coder's Remorse"?

2005-09-28 Thread Poor Yorick
Danny Yoo wrote: >You may want to change the data structure. > >Rather than have points all be peers, reorganize them so that there's some >kind of hierarchy: that'll help you directly represent the "sharing" of >attributes. Explicitly: > >#

[Tutor] hiding a notebook page

2005-09-28 Thread Jeff Peery
hello, I'm using wxpython to write a windows app. I want to be able to hide a page in a notebook and I'm not sure how to do it. functionally its the same as doing:   notebook.Show(False)   but I want that to work for just one notebook page and not the whole notebook. I tried the wxpython list but d

[Tutor] Frustrated Beginner

2005-09-28 Thread Rosalee Dubberly
I am trying to learn Python to use in my lesson plans. I am using Windows XP and the textbooks I am using are Beginning Python by WROX and Learning Pyhton by O'Reilly. I am definning a range of words 0 to 55, if the number is divisible by 3,7,11 with no remainder print eggs, else print spam. T

Re: [Tutor] Frustrated Beginner

2005-09-28 Thread R. Alan Monroe
> I am trying to learn Python to use in my lesson plans. I am using Windows XP > and the textbooks I am using are Beginning Python by WROX and Learning > Pyhton by O'Reilly. > I am definning a range of words 0 to 55, if the number is divisible by > 3,7,11 with no remainder print eggs, else prin

Re: [Tutor] Frustrated Beginner

2005-09-28 Thread Brian van den Broek
Rosalee Dubberly said unto the world upon 2005-09-28 15:41: > I am trying to learn Python to use in my lesson plans. I am using > Windows XP and the textbooks I am using are Beginning Python by WROX and > Learning Pyhton by O'Reilly. > > I am definning a range of words 0 to 55, if the number is

[Tutor] call a def/class by reference

2005-09-28 Thread DS
Is it possible to call a function or class by reference, aside from using an eval approach? What I would like to do is have a loop that processes functions by: 1. gettting the input that consists of a function and its parameters, 2. determining if the function is on an approved function

Re: [Tutor] call a def/class by reference

2005-09-28 Thread Adam
How about something like this def foo(bar):     print bar d = {"foo":foo} s = "foo" params = "bar" try: d[s](params) except: KeyError Then you can just put the allowed functions into the dictionary.On 29/09/05, DS <[EMAIL PROTECTED] > wrote:Is it possible to call a function or class by reference

Re: [Tutor] call a def/class by reference

2005-09-28 Thread DS
Thanks for answering my question. What I'm hoping to avoid is an explicit reference to any of the called functions within the program. By doing it that way, it would avoid a maintenance problem of having to remember to put a reference for every new function in the calling program. ds Adam wro

[Tutor] help with running graphics program

2005-09-28 Thread Goofball223
Hello I downloaded the graphics.py file and have it saved on my computer but everytime I run the following program I seem to keep getting an error. from graphics import* def main():    win=GraphWin()    shape = Circle(Point(50,50), 20)    shape.setOutline("red")    shape.setFill("red")    s

[Tutor] Alan's responce frustrated beginner

2005-09-28 Thread Rosalee Dubberly
I want to save this file, import it and make the changes, eggs = toast, spam = jelly and change the values if needed. def firstpart(): for n in range(0, 55): if n % 3 == 0 or n % 7 == 0 or n % 11 == 0: print 'eggs,', else: print 'spam,', Rosa Dubberly _

[Tutor] More than one thing at a time?

2005-09-28 Thread Joseph Quigley
Hi, I've got a problem: I've got a semi working IRC client. There's a function that is for receiving and one for sending. How can I have a loop where I can receive messages, yet still have a send prompt? Thanks, Joe ___ Tutor maillist - Tutor@pyth

Re: [Tutor] call a def/class by reference

2005-09-28 Thread Danny Yoo
> Thanks for answering my question. What I'm hoping to avoid is an > explicit reference to any of the called functions within the program. > By doing it that way, it would avoid a maintenance problem of having to > remember to put a reference for every new function in the calling > program. In

Re: [Tutor] help with running graphics program

2005-09-28 Thread Danny Yoo
On Wed, 28 Sep 2005 [EMAIL PROTECTED] wrote: > I downloaded the graphics.py file and have it saved on my computer but > everytime I run the following program I seem to keep getting an error. [some text cut] > Traceback (most recent call last): > File "C:/Python24/circle", line 1, in -topleve

[Tutor] drawing squares

2005-09-28 Thread Goofball223
Hello How would I get the following program to draw squares instead of circles? from graphics import* def main():    win=GraphWin()    shape = Circle(Point(50,50), 20)    shape.setOutline("red")    shape.setFill("blue")    shape.draw(win)    for i in range(10):    p = win.getMouse()

Re: [Tutor] Alan's responce frustrated beginner

2005-09-28 Thread Danny Yoo
On Wed, 28 Sep 2005, Rosalee Dubberly wrote: > I want to save this file, import it and make the changes, eggs = toast, spam > = jelly and change the values if needed. > > def firstpart(): >for n in range(0, 55): > if n % 3 == 0 or n % 7 == 0 or n % 11 == 0: > print 'eggs,', >

Re: [Tutor] drawing squares

2005-09-28 Thread Danny Yoo
On Wed, 28 Sep 2005 [EMAIL PROTECTED] wrote: > How would I get the following program to draw squares instead of circles? What have you tried so far? What part of your program is the part responsible for drawing circles? What happens if you change that part? To tell the blunt truth, the ques

Re: [Tutor] call a def/class by reference (fwd)

2005-09-28 Thread Danny Yoo
-- Forwarded message -- Date: Wed, 28 Sep 2005 17:11:07 -0700 From: DS <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] call a def/class by reference Danny Yoo wrote: > > >>Thanks for answering my question. What I'm hoping to avoid is an >>explicit ref

Re: [Tutor] call a def/class by reference

2005-09-28 Thread DS
Danny Yoo wrote: > > >>Thanks for answering my question. What I'm hoping to avoid is an >>explicit reference to any of the called functions within the program. >>By doing it that way, it would avoid a maintenance problem of having to >>remember to put a reference for every new function in the

Re: [Tutor] drawing squares

2005-09-28 Thread Danny Yoo
> Otherwise, it really looks like you don't care about anything other than > getting a "right answer", and nothing demotivates a volunteer more than > being asked to do someone else's homework. We're interested in helping > people understand how to solve problems, but we're really not interested

[Tutor] stopping threads?

2005-09-28 Thread Marcus Goldfish
I'm a little confused about threading in Python.  Here is a sample class I've written for monitoring for events.  Included in the comments are a couple of questions, specifically:      (1) can I use super() in the constructor, or is direct call to base class preferred?    (2) do I need to sleep in

[Tutor] Flattening multi-dimentional list

2005-09-28 Thread Bernard Lebel
Hello, I have this list wich is made of tuples. I wish I could "flatten" this list, that is, to extract each element in the tuples and build a new flat list with it. Is there any shortcut to do that or do I have to go through some list comprehension-like procedure? (I have looked at sets but I ha

Re: [Tutor] Flattening multi-dimentional list

2005-09-28 Thread Danny Yoo
On Wed, 28 Sep 2005, Bernard Lebel wrote: > I have this list wich is made of tuples. I wish I could "flatten" this > list, that is, to extract each element in the tuples and build a new > flat list with it. Is there any shortcut to do that or do I have to go > through some list comprehension-lik

Re: [Tutor] Flattening multi-dimentional list

2005-09-28 Thread Bernard Lebel
Thanks a lot Danny. Bernard On 9/28/05, Danny Yoo <[EMAIL PROTECTED]> wrote: > > > On Wed, 28 Sep 2005, Bernard Lebel wrote: > > > I have this list wich is made of tuples. I wish I could "flatten" this > > list, that is, to extract each element in the tuples and build a new > > flat list with

Re: [Tutor] Problem with BeautifulSoup

2005-09-28 Thread Bernard Lebel
Hi Kent, Thanks a lot for that answer. I have had a look at the BS code, and I have to admit I'm a bit at a loss: how would you add several nestable tag names in that list? I tried NESTABLE_TAGS = BeautifulSoup.buildTagMap( [], 'parameter', 'parameters' ) for example, but I kept having these nest

Re: [Tutor] call a def/class by reference

2005-09-28 Thread bob
At 04:29 PM 9/28/2005, DS wrote: >What I'm hoping to avoid is an >explicit reference to any of the called functions within the program. >By doing it that way, it would avoid a maintenance problem of having to >remember to put a reference for every new function in the calling program. Try this - a

Re: [Tutor] Flattening multi-dimentional list

2005-09-28 Thread Kent Johnson
Bernard Lebel wrote: > Hello, > > I have this list wich is made of tuples. I wish I could "flatten" this > list, that is, to extract each element in the tuples and build a new > flat list with it. Is there any shortcut to do that or do I have to go > through some list comprehension-like procedure?

Re: [Tutor] stopping threads?

2005-09-28 Thread John Fouhy
On 29/09/05, Marcus Goldfish <[EMAIL PROTECTED]> wrote: > I'm a little confused about threading in Python. Here is a sample class > I've written for monitoring for events. Included in the comments are a > couple of questions, specifically: Hi Marcus, >(1) can I use super() in the constructo

Re: [Tutor] stopping threads?

2005-09-28 Thread Pierre Barbier de Reuille
Hello Marcus, Marcus Goldfish a écrit : > I'm a little confused about threading in Python. Here is a sample class I've > written for monitoring for events. Included in the comments are a couple of > questions, specifically: > (1) can I use super() in the constructor, or is direct call to base cl

Re: [Tutor] Reformatting a one (long) line xml file

2005-09-28 Thread Negroup -
2005/9/28, Christopher Arndt <[EMAIL PROTECTED]>: [cut] > > See http://www.python.org/doc/current/lib/module-xml.dom.minidom.html for more > info. Hi, this seems to be exactly what I was looking for! import sys from xml.dom import minidom INDENT = ' ' * 4 file = sys.argv[1] content = open(file