Re: [Tutor] "standard output: Broken pipe"

2007-10-21 Thread Eric Brunson
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. Here's the important concepts to understand. The pipe is a construct of the shell,

[Tutor] calling a variable name

2007-10-21 Thread Bryan Fodness
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? unblockedFS=13.4 for line in file('21Ex6MV_tmr.dat'): d, fs1, fs2, fs

Re: [Tutor] Looping + Variables

2007-10-21 Thread Martin Walsh
James wrote: > Hi. :) > > I'm trying to write a loop to simplify my life (and code :)). The > loop is going to iterate over a list of values that I have to change > in a file. I think my problem is better described with some code. :) Use a dictionary instead of a tuple ... # variables editVal

Re: [Tutor] String module; Count

2007-10-21 Thread ddm2
Hi, Not sure if this is necessary, as I sent another email to the list (I think), but since I'm new to this thing, I thought I'd do the safe thing and try a second time. The code almost works now. Although, as soon as the converter gets a number -8 or lower, it adds a 0 that is not necessary. CO

Re: [Tutor] "standard output: Broken pipe"

2007-10-21 Thread Martin Walsh
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 SIGPIPE. While this w

Re: [Tutor] "standard output: Broken pipe"

2007-10-21 Thread Martin Walsh
James wrote: > Given this explanation, it's probably not a great idea to use > signal.signal() then. ;) In this case, it seems to me that setting the SIG_DFL action for SIGPIPE is precisely what one would want to do. This is pure speculation, but if you were to re-implement some of the subproc

Re: [Tutor] how to read from an excel file?

2007-10-21 Thread Alan Gauld
"pierre cutellic" <[EMAIL PROTECTED]> wrote > But i don't really know what are the next steps. I presume that it > should > start by: > > import win32com.client > xl = win32com.client.Dispatch("Excel.Application") Before you try using COM to read the spreadsheet I'd consider using some of the va

[Tutor] Looping + Variables

2007-10-21 Thread James
Hi. :) I'm trying to write a loop to simplify my life (and code :)). The loop is going to iterate over a list of values that I have to change in a file. I think my problem is better described with some code. :) # variables interface = "eth0" address = "192.168.1.5" mask = "255.255.255.0"

Re: [Tutor] populating an array or using a dictionary

2007-10-21 Thread Kent Johnson
Michael Langford wrote: > A neater way to do it looks like: > > dic2 = {} > countOfVars=40 > for line in file('foo.dat'): > tokens = line.split() > dval = tokens[0] > ls = [] > for i in range(1,countOfVars+1): > ls.append(float(tokens[i])) > dic2[dval]=tuple(ls) > p

Re: [Tutor] populating an array or using a dictionary

2007-10-21 Thread Kent Johnson
Bryan Fodness wrote: > it doesn't fix the problem, now it says there is a syntax error on the > equal sign. Please, post your code and the exact error message and traceback! Don't make us guess what you are doing! My guess is you forgot the closing ) but I have no way to know for sure. Kent >

[Tutor] how to read from an excel file?

2007-10-21 Thread pierre cutellic
Hi, I'm actually trying to understand how to read data from an excel file but i'm pretty stuck here: I have already used makepy to generate the excel modules and its ID, which looks like : 00020813---C000-0046 But i don't really know what are the next steps. I presume that it sh

Re: [Tutor] populating an array or using a dictionary

2007-10-21 Thread Michael Langford
Using the attached foo.dat and no linebreaks, what you're doing works perfectly: dic2 = {} for line in file('foo.dat'): d, fs1, fs2, fs3, fs4, fs5, fs6, fs7, fs8, fs9, fs10, fs11, fs12, fs13, fs14, fs15, fs16, fs17, fs18, fs19, fs20, fs21, fs22, fs23, fs24, fs25, fs26, fs27, fs28, fs29, fs30, f

Re: [Tutor] populating an array or using a dictionary

2007-10-21 Thread Bryan Fodness
it works well if it is on the same line, but I would like to wrap it for readability On 10/21/07, Bryan Fodness <[EMAIL PROTECTED]> wrote: > > it doesn't fix the problem, now it says there is a syntax error on the > equal sign. > > On 10/21/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > > > > > "Br

Re: [Tutor] populating an array or using a dictionary

2007-10-21 Thread Bryan Fodness
it doesn't fix the problem, now it says there is a syntax error on the equal sign. On 10/21/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > > "Bryan Fodness" <[EMAIL PROTECTED]> wrote in > > >d, fs1, fs2, fs3, fs4, fs5, fs6, fs7, fs8, fs9, fs10, > >fs11, fs12, fs13, fs14, fs15, fs16, fs17, f

Re: [Tutor] populating an array or using a dictionary

2007-10-21 Thread Alan Gauld
"Bryan Fodness" <[EMAIL PROTECTED]> wrote in >d, fs1, fs2, fs3, fs4, fs5, fs6, fs7, fs8, fs9, fs10, >fs11, fs12, fs13, fs14, fs15, fs16, fs17, fs18, fs19, >fs20, fs21, fs22, fs23, fs24, fs25, fs26, fs27, fs28, >fs29, fs30, fs31, fs32, fs33, fs34, fs35, fs36, fs37, >fs38, fs39

Re: [Tutor] populating an array or using a dictionary

2007-10-21 Thread Bryan Fodness
Here is my code. dic2 = {} 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, fs21, fs22, fs23, fs24, fs25, fs26, fs27, fs28, fs29, fs30, fs31, fs32, fs33, fs34, fs35, fs36, fs37,

Re: [Tutor] "standard output: Broken pipe"

2007-10-21 Thread Alan Gauld
"Michael Langford" <[EMAIL PROTECTED]> wrote >I think Alan is exaggerating the danger of signal handlers. Indeed, thats why I sent the follow up. They aren't *dangerous* but they can be inconsistent across OS. Plus some signals are wider in scope that the curent process (eg ISTR Stop-A on a

Re: [Tutor] "standard output: Broken pipe"

2007-10-21 Thread Michael Langford
I think Alan is exaggerating the danger of signal handlers. They are *not* dangerous at all, but you should know what each signal means before you install a handler over its default, so you don't surprise yourself with behavior. For instance, you can capture ctrl-C which usually send a SIGINT. Pyth

[Tutor] python help

2007-10-21 Thread Michael Langford
http://developer.yahoo.com/python/python-rest.html#post On 10/21/07, SwartMumba snake <[EMAIL PROTECTED]> wrote: > I have tried to find out the solution my self, and have failed to do so. > So here is my problem: > > I want to submit text into an edit box on a web page. ie the equivalent of > me

[Tutor] python help

2007-10-21 Thread SwartMumba snake
I have tried to find out the solution my self, and have failed to do so. So here is my problem: I want to submit text into an edit box on a web page. ie the equivalent of me typing text into the edit box and clicking the submit button. __ Do You

Re: [Tutor] populating an array or using a dictionary

2007-10-21 Thread Aditya Lal
If the ease of use is the only answer then the size of the file should not matter ideally. btw, how large is the file ? is it in MBs or GBs ? For performance reasons, typically you should not have any problems using either dictionary, array or list for file size of few KBs. Like Kent said, if you