Re: [Tutor] walking directories

2005-01-07 Thread Jacob S.
> Shouldn't that be os.path.walk()? It says in the documentation (it might be the newer ones?): "Note: The newer os.walk() generator supplies similar functionality and can be easier to use." -- 6.2 os.path -- Common pathname manipulations And, yet, the os.walk() function states (condensed):

Re: [Tutor] Problem with a variable in a CGI program

2005-01-07 Thread Jacob S.
> line of white space. Could it be you have an unterminated > string (missing close quotes) at the end of your program? > > Alan G I would like to add maybe a missing or extra parenthesis? I have trouble with that alot. Jacob ___ Tutor maillist - Tut

Re: [Tutor] import question

2005-01-07 Thread Jacob S.
> It should work as you describe it. > Can you just clarify how you are doing this? > Are you setting sys.path in the same program you > are trying to run? Or is it set in a Python startup script? > > How do you run a.py? Are you importing it into an existing > Python session(with sys.path set or a

Re: [Tutor] German Tutorials auf Deutsch

2005-01-07 Thread Jacob S.
## Spoken by Ara ## Pardon to the non-german speaking (or readers) on the list. Guten Tag. Mein Deutsch ist nicht so gut (ich habe keinen Deutsche in sieben Jahren geschreiben). Mann kann Python Tutorials auf Deutsch heir http://www.freenetpages.co.uk/hp/alan.gauld/german/index.htm und http://hkn.

[Tutor] Recommended SOAP libraries

2005-01-07 Thread Tim Johnson
What SOAP libraries might be recommended for python? -- thanks tim -- Tim Johnson <[EMAIL PROTECTED]> http://www.alaska-internet-solutions.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] import question

2005-01-07 Thread Alan Gauld
> I'm trying to import classes and functions across > several directories. > Here's a simple example of my filesystem: > /Defs > base.py > /One > a.py > b.py > /Two > c.py > > In a.py I have: > ### > import b > ### > This results in an error: >

Re: [Tutor] walking directories

2005-01-07 Thread Alan Gauld
> I have many python scripts in various directories of > varying depth under my home directory, and I need to > change one line in each of these files. personally I'd use find and sed in Linux, right tool for the job etc... But if you really must wheel out a howitzer to shoot a squirrel... >

Re: [Tutor] Problem with a variable in a CGI program

2005-01-07 Thread Alan Gauld
> But now I have much weirder problem... > I got this error: > > C:\>maillist.py > File "C:\maillist.py", line 84 > >^ > SyntaxError: invalid syntax > > And the weird thing is that the program has only 83 lines... > For some reas

RE: [Tutor] walking directories

2005-01-07 Thread Ryan Davis
I think you want to be doing something like: >>>for r,d,f in os.walk('.'): ... for filename in f: ... print os.path.join(r,filename) I think that would give you the full path of every file, and then you can open it, do a regex substitution or whatever close it and keep going. Th

[Tutor] walking directories

2005-01-07 Thread Nick Lunt
Hi folks, Im running python2.4 on linux. I have many python scripts in various directories of varying depth under my home directory, and I need to change one line in each of these files. I thought about using os.walk with os.path.join eg >>> for r,d,f in os.walk('.'): ... print os.path.joi

Re: [Tutor] Lottery simulation

2005-01-07 Thread Jacob S.
Unfortunately as I overly enjoy writing scripts, I tend to spoil the recipients of the tutor. IF you do not wish to have a complete answer, read someone else's email and not mine.   ### Start code### import random   participants = 10ask = [raw_input('What is the participan

[Tutor] import question

2005-01-07 Thread Ryan Davis
Hello all,   I'm just starting to use python seriously, and am having problems understanding exactly what is going on with import statements and the sys.path variable.   I'm trying to import classes and functions across several directories.  Here's a simple example of my filesystem: /D

Re: [Tutor] Problem with a variable in a CGI program

2005-01-07 Thread Danny Yoo
> But now I have much weirder problem... > I got this error: > > C:\>maillist.py > File "C:\maillist.py", line 84 > >^ > SyntaxError: invalid syntax > > And the weird thing is that the program has only 83 lines... For some > re

Re: [Tutor] Problem with a variable in a CGI program

2005-01-07 Thread Mark Kels
On Fri, 7 Jan 2005 11:16:29 -0800 (PST), Danny Yoo <[EMAIL PROTECTED]> wrote: > > > On Fri, 7 Jan 2005, Mark Kels wrote: > > > I started to read the following code (I will start working on it when > > this problem is fixed) and it looks OK while I read it. But for some > > reason it doesn't work

Re: [Tutor] Problem with a variable in a CGI program

2005-01-07 Thread Danny Yoo
On Fri, 7 Jan 2005, Mark Kels wrote: > I started to read the following code (I will start working on it when > this problem is fixed) and it looks OK while I read it. But for some > reason it doesn't work... Hi Mark, Ok, let's take a look at the error message: > Traceback (most recent call

Re: [Tutor] trouble getting a list to update

2005-01-07 Thread Kent Johnson
Vincent Wan wrote: So You were doing fine up to here... for x in list: do_something_with_an_element(list[x]) and python keeps track of x for you. Now you are back into your original mistake! It should be for x in list: do_something_with_an_element(x) The variable in a for loop receives the ac

Re: [Tutor] trouble getting a list to update

2005-01-07 Thread Vincent Wan
PROBLEM SOLVED THANK YOU DANNY AND ALAN To recap: My program main loop called two functions one that changed a list and one that printed the list. Turns out that print function was bad. I didn't understand how clever pythons for statement is. I wrote: def write_list(list_to_write, file_name):

[Tutor] Problem with a variable in a CGI program

2005-01-07 Thread Mark Kels
HI all ! I started to read the following code (I will start working on it when this problem is fixed) and it looks OK while I read it. But for some reason it doesn't work... Here is the code: # MailList is copyright (c) 2000 of Programmed Integration # You may use this code in any way you see fit,

Re: [Tutor] trouble getting a list to update

2005-01-07 Thread Alan Gauld
> def write_list(list_to_write, file_name): > "Writes elements of a list, seperated by spaces, to a file" > for each in list_to_write: > file_name.write(str(list_to_write[each]) + ' ') This is the problem.(I think) You are taking each element of the list then using it(either 0