Re: [Tutor] String module; Count

2007-10-22 Thread Alan Gauld
[EMAIL PROTECTED] wrote think), but since I'm new to this thing, I thought I'd do the safe thing and try a second time. I personally didn't see the earlier one so can't say if it got here or not. But I'll throw in some comments below. But first I will say that you seem to be going out of

Re: [Tutor] calling a variable name

2007-10-22 Thread Alan Gauld
Bryan Fodness [EMAIL PROTECTED] wrote I want to get a variable name dependent on another variable. Thats usually a bad idea, but... I have tried, 'fs' + str(int(round(unblockedFS))) for fs13 I have no idea what you think this will do. It gives a syntax error for me, which is what I

Re: [Tutor] calling a variable name

2007-10-22 Thread Bryan Fodness
Here is the actual snippet of code calc_depth =8.1 # which is actually d unblockedFS = 13.4 # which is the indexed fs for line in file('21Ex6MV_tmr.dat'): d, fs1, fs2, fs3, fs4, fs5, fs6, fs7, fs8, fs9, fs10, fs11, fs12, fs13, fs14, fs15, fs16, fs17, fs18, fs19, fs20,

Re: [Tutor] calling a variable name

2007-10-22 Thread Tino Dai
On 10/21/07, Bryan Fodness [EMAIL PROTECTED] wrote: I want to get a variable name dependent on another variable. I have tried, 'fs' + str(int(round(unblockedFS))) for fs13 and I get an invalid literal. If I code in the fs13, everything works. Is it possible to do this?

Re: [Tutor] standard output: Broken pipe

2007-10-22 Thread Martin Walsh
Eric Brunson wrote: I'm coming in late to the discussion and thought that someone would explain it succinctly, but there have been so many correct statements which I feel fail to nail down the problem that I thought I'd chime in. Hi Eric, Thank you for your considerate response. Your

Re: [Tutor] calling a variable name

2007-10-22 Thread Kent Johnson
Bryan Fodness wrote: Here is the actual snippet of code calc_depth =8.1 # which is actually d unblockedFS = 13.4 # which is the indexed fs for line in file('21Ex6MV_tmr.dat'): d, fs1, fs2, fs3, fs4, fs5, fs6, fs7, fs8, fs9, fs10, fs11, fs12, fs13, fs14, fs15,

Re: [Tutor] calling a variable name

2007-10-22 Thread Evert Rol
Here is the actual snippet of code calc_depth =8.1 # which is actually d unblockedFS = 13.4 # which is the indexed fs for line in file('21Ex6MV_tmr.dat'): d, fs1, fs2, fs3, fs4, fs5, fs6, fs7, fs8, fs9, fs10, fs11, fs12, fs13, fs14, fs15, fs16, fs17, fs18, fs19,

Re: [Tutor] standard output: Broken pipe

2007-10-22 Thread Eric Brunson
Martin Walsh wrote: Eric Brunson wrote: I'm coming in late to the discussion and thought that someone would explain it succinctly, but there have been so many correct statements which I feel fail to nail down the problem that I thought I'd chime in. Hi Eric, Thank you for your

Re: [Tutor] calling a variable name

2007-10-22 Thread Bryan Fodness
Thank you. This works well. I am still trying to figure out the pros and cons of using an array, dictionary or list. On 10/22/07, Kent Johnson [EMAIL PROTECTED] wrote: Bryan Fodness wrote: Here is the actual snippet of code calc_depth =8.1 # which is actually d

Re: [Tutor] calling a variable name

2007-10-22 Thread Kent Johnson
Bryan Fodness wrote: Thank you. This works well. I am still trying to figure out the pros and cons of using an array, dictionary or list. Array is specialized, you probably want list or dict. Use list when you want a sequence of items indexed by sequential integers. Lists - preserve order -

[Tutor] how to read from a csv file?

2007-10-22 Thread pierre cutellic
Hi, this is a module i wrote to catch some data from a csv file: ## #module csv data reader # open a csv file and return its data import csv import sys def __init__(self): rawdata = [] f = open('datalisting_000.csv','r') try: reader = csv.reader(f) for

Re: [Tutor] how to read from a csv file?

2007-10-22 Thread Tim Golden
pierre cutellic wrote: Hi, this is a module i wrote to catch some data from a csv file: ## #module csv data reader # open a csv file and return its data import csv import sys def __init__(self): Stop right there. You're confusing modules and classes. A class has a

[Tutor] pgdb and unicode

2007-10-22 Thread Ismael Farfán Estrada
Hi there. I have a small system in production with wxPython and PostgreSQL running on a machine with Centos 5. At first everytihing was running ok but now a weird bug was discovered: they can't insert characters like á é í ó ú ä ë ñ (non english characters) Does anyone knows how can I make

Re: [Tutor] pgdb and unicode

2007-10-22 Thread Kent Johnson
Ismael Farfán Estrada wrote: Hi there. I have a small system in production with wxPython and PostgreSQL running on a machine with Centos 5. At first everytihing was running ok but now a weird bug was discovered: they can't insert characters like á é í ó ú ä ë ñ (non english characters)

Re: [Tutor] how to read from a csv file?

2007-10-22 Thread Eric Walstad
Tim Golden wrote: You really just want to rename __init__ to rawdata and drop the redundant return rawdata function. But remember to include the line: return rawdata at the end of your function or else nothing will be printed when print csvdatareader.rawdata() is called. Also, I'd

Re: [Tutor] pgdb and unicode

2007-10-22 Thread Ismael Farfán Estrada
Ismael Farfán Estrada wrote: Hi there. I have a small system in production with wxPython and PostgreSQL running on a machine with Centos 5. At first everytihing was running ok but now a weird bug was discovered: they can't insert characters like á é í ó ú ä ë ñ (non english

Re: [Tutor] pgdb and unicode

2007-10-22 Thread Eric Brunson
Kent Johnson wrote: Ismael Farfán Estrada wrote: Hi there. I have a small system in production with wxPython and PostgreSQL running on a machine with Centos 5. At first everytihing was running ok but now a weird bug was discovered: they can't insert characters like á é í ó ú ä ë ñ

Re: [Tutor] pgdb and unicode

2007-10-22 Thread Kent Johnson
Ismael Farfán Estrada wrote: by the way, does sending the data as a list prevent SQL injection? Yes. I haven't worried for that yet. If you are accepting user input and putting it into the database, you should worry about it. See http://xkcd.com/327/ for a humorous take on this ;-) Kent

[Tutor] Negative Signed Binary Conversion

2007-10-22 Thread ddm2
Hi, I'm trying to get this binary converter working, but I can't seem to get the negatives to work properly. If the integer is too low, the 0's that are added for the amount of bits gets out of whack. I've tried to solve the problem by adding another 'count' meter by which I can then tell if there

Re: [Tutor] Negative Signed Binary Conversion

2007-10-22 Thread Eric Brunson
Why not find the sign, calculate the binary of the absolute value, then make the result negative (twos complement) if necessary? Just a thought. [EMAIL PROTECTED] wrote: Hi, I'm trying to get this binary converter working, but I can't seem to get the negatives to work properly. If the

Re: [Tutor] Negative Signed Binary Conversion

2007-10-22 Thread Eric Brunson
So far I've gotten five copies of this. It could be mailman doing something wrong, but if you're resending because you don't see your reply, please be patient, this list is not always instantaneous. I think you're missing the gist of what I'm saying. Calculate the binary of the absolute.

[Tutor] multithreaded debugger

2007-10-22 Thread Tino Dai
Hi Everybody, Is there a multi-threaded debugger in Python? I running into some problems and a debugger would be very helpful here. Thanks, Tino ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] multithreaded debugger

2007-10-22 Thread Kent Johnson
Tino Dai wrote: Hi Everybody, Is there a multi-threaded debugger in Python? I running into some problems and a debugger would be very helpful here. Maybe Winpdb would help: http://www.digitalpeers.com/pythondebugger/ Kent ___ Tutor maillist

Re: [Tutor] standard output: Broken pipe

2007-10-22 Thread James
That's not a half-baked idea. ;) I'm not really sure how I would replace 'yes', though, in this situation. Thoughts? .james On Oct 22, 2007, at 10:33 AM, Eric Brunson wrote: Just another reason why I would look for a solution that would avoid the yes altogether. :-)

Re: [Tutor] Negative Signed Binary Conversion

2007-10-22 Thread Eric Brunson
No worries. I said it could be mailman, and apparently it was. :-) [EMAIL PROTECTED] wrote: Hi, I also got this email five times, and several rejection emails from the moderator. I'm very sorry for this, but I swear I only sent the email once. If this Apology email is also sent multiple

Re: [Tutor] standard output: Broken pipe

2007-10-22 Thread Eric Brunson
Martin Walsh wrote: Michael Langford wrote: This signal is not something you care about. All SIGPIPE means is that the source of the signal found itself writing to a pipe with no sender. Your line signal.signal(signal.SIGPIPE, signal.SIG_DFL) means use the default signal handler for

Re: [Tutor] standard output: Broken pipe

2007-10-22 Thread Alan Gauld
James [EMAIL PROTECTED] wrote I'm not really sure how I would replace 'yes', though, in this situation. Thoughts? Just read the output of Popen from stdout and respond with a 'y' to stdin until the process finishes. See the example in the documentation of Popen replacing os.popen...

Re: [Tutor] Negative Signed Binary Conversion

2007-10-22 Thread Alan Gauld
[EMAIL PROTECTED] wrote I'm trying to get this binary converter working, but I can't seem to get the negatives to work properly. I already sent a reply on this, but: def conversion(n): b = '' while n 0: This line means you only ever return an empty string for a negative n...

[Tutor] Offtopic Reply, was: Negative Signed Binary Conversion

2007-10-22 Thread Eric Brunson
You know, Alan, I remember you commenting that you had some flakey behavior from this list a few of weeks ago, then over the weekend I received about two dozen emails from threads as far back as August. Something is definitely wonky (technical term ;-) about this list server. Alan Gauld

[Tutor] URLLIB / GLOB

2007-10-22 Thread John
Hello, I would like to write a program which looks in a web directory for, say *.gif files. Then processes those files in some manner. What I need is something like glob which will return a directory listing of all the files matching the search pattern (or just a simply a certain extension). Is

Re: [Tutor] URLLIB / GLOB

2007-10-22 Thread Kent Johnson
John wrote: Hello, I would like to write a program which looks in a web directory for, say *.gif files. Then processes those files in some manner. What I need is something like glob which will return a directory listing of all the files matching the search pattern (or just a simply a

Re: [Tutor] standard output: Broken pipe

2007-10-22 Thread Martin Walsh
Eric Brunson wrote: Martin Walsh wrote: Michael Langford wrote: I don't think this is quite right, but please correct me if I'm misinformed, or just plain wrong. :) Using signal.signal(signal.SIGPIPE, signal.SIG_IGN) (kernel 2.6.20, bash 3.2, python2.5) I just noticed something, Martin.