Re: [Tutor] Verifying My Troublesome Linkage Claim between Python and Win7

2010-02-28 Thread Alan Gauld
"Wayne Watson" wrote incoherency. For what it's worth, and that's about zero, I'm working with my old XP and W7 machine's keyboards, mice and monitors side-by-side. I have several times found my self using the wrong device. In that situation I find it useful to make the old environment as h

[Tutor] CGI File Uploads

2010-02-28 Thread Giorgio
Hi, today i need some help with the python manual. I've found this fileupload example http://webpython.codepoint.net/cgi_file_upload on that site. It's taking from fileitem attributes like filename and file. Where is the complete list of those attributes or methods? Thankyou -- -- AnotherNet

Re: [Tutor] Verifying My Troublesome Linkage Claim between Python and Win7

2010-02-28 Thread Dave Angel
Wayne Watson wrote: You tell us to "try this" and give a folder structure: Folder1 track1.py data1.txt data2.txt data3.txt Folder2 track1.py dset1.txt dset2.txt ... dset8.txt Maybe one simple test at a time will get better responses. Since you

[Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Karim Liateni
Hello Tutor, Since Friday I get no answers to my first post. So I re-post it was missed by the numerous arriving email: This is my first program in python. I am doing electrical simulation in spectre (spice like). I have a models file which holds many parameters and include files of parameters

Re: [Tutor] Omitting lines matching a list of strings from a file

2010-02-28 Thread galaxywatcher
One formatting detail: there is a blank line after each line printed, how do I ged rid of the extra blank lines? lines = [line.strip() for line in infile if line[146:148] not in omit_states] print '\n'.join(lines) This approach stripped leading blank spaces introducing errors into my fi

Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Alan Gauld
"Karim Liateni" wrote It concatenates both parameters and include files with the same parameters definitions. That trigs errors during simulation and it complains about parameters double definition. I'd suggest you construct a dictionary based on the param names You can check before you add c

Re: [Tutor] CGI File Uploads

2010-02-28 Thread Alan Gauld
"Giorgio" wrote It's talking from fileitem attributes like filename and file. Where is the complete list of those attributes or methods? Probably on a web page somewhere but you are probably better using the help() function and dir() to examine an instance from the >>> prompt. HTH, --

Re: [Tutor] CGI File Uploads

2010-02-28 Thread Giorgio
Alan, i don't know how to use it in this case. import cgi form = cgi.FieldStorage() fileitem = form['file'] fileitem.file.read() Function dir() lists all functions in a module, i could only use it for "cgi" O_O. Thankyou 2010/2/28 Alan Gauld > > "Giorgio" wrote > > It's talking from fileite

Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Lie Ryan
On 03/01/10 01:12, Alan Gauld wrote: > >> def getLines(file): >> """Get the content of a file in a lines list form.""" >> f = open(file, 'r') >> lines = f.readlines() >> f.close() >> return lines > > I'm not sure these functions add enough value to ghave them. I';d > probably just use >

Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Karim Liateni
Hello Alan, Alan Gauld wrote: "Karim Liateni" wrote It concatenates both parameters and include files with the same parameters definitions. That trigs errors during simulation and it complains about parameters double definition. I'd suggest you construct a dictionary based on the param na

Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Karim Liateni
Lie Ryan wrote: On 03/01/10 01:12, Alan Gauld wrote: def getLines(file): """Get the content of a file in a lines list form.""" f = open(file, 'r') lines = f.readlines() f.close() return lines I'm not sure these functions add enough value to ghave them. I';d probably just use

Re: [Tutor] CGI File Uploads

2010-02-28 Thread ALAN GAULD
> Alan, i don't know how to use it in this case. > > import cgi > form = cgi.FieldStorage() > fileitem = form['file'] > Function dir() lists all functions in a module, i could only use it for "cgi" It will list all the names in any kind of object not just a module. If you type the code abov

Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Lie Ryan
On 03/01/10 02:49, Karim Liateni wrote: > Lie Ryan wrote: >> On 03/01/10 01:12, Alan Gauld wrote: >> def getLines(file): """Get the content of a file in a lines list form.""" f = open(file, 'r') lines = f.readlines() f.close() return lines >>>

Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Karim Liateni
Lie Ryan wrote: On 03/01/10 02:49, Karim Liateni wrote: Lie Ryan wrote: On 03/01/10 01:12, Alan Gauld wrote: def getLines(file): """Get the content of a file in a lines list form.""" f = open(file, 'r') lines = f.readlines() f.close() return lines

[Tutor] Over-riding radians as default for trig calculations

2010-02-28 Thread AG
After importing the math module and running math.cos( x ) the result is in radians. Is there a way of setting this so that it results in degrees? I don't want to over-ride this permanently for my Python settings, so am happy to specifically do it per equation or per program. Thanks in adva

Re: [Tutor] Over-riding radians as default for trig calculations

2010-02-28 Thread Hugo Arts
On Sun, Feb 28, 2010 at 8:39 PM, AG wrote: > After importing the math module and running > > math.cos( x ) > > the result is in radians. > > Is there a way of setting this so that it results in degrees?  I don't want > to over-ride this permanently for my Python settings, so am happy to > specific

Re: [Tutor] Over-riding radians as default for trig calculations

2010-02-28 Thread Steven D'Aprano
On Mon, 1 Mar 2010 06:39:10 am AG wrote: > After importing the math module and running > > math.cos( x ) > > the result is in radians. It certainly is not. The *result* of cos is a unitless number, not an angle. What you mean is that the *input* to cos, x, has to be supplied in radians. No, you

[Tutor] OOD - Another class question

2010-02-28 Thread James Reynolds
I have another question related to OOD. What I have is a module with one parent class and two child classes. Some stuff is done to the object that is passed to the function in one of the child classes and this then calls a function from the global class passing local variables (from the child class

Re: [Tutor] OOD - Another class question

2010-02-28 Thread Steve Willoughby
On Sun, Feb 28, 2010 at 06:24:09PM -0500, James Reynolds wrote: > I have another question related to OOD. What I have is a module with one > parent class and two child classes. Some stuff is done to the object that is > passed to the function in one of the child classes and this then calls a > func

Re: [Tutor] Any Tutor there ? Removing redundant parameters in a models file having include files.

2010-02-28 Thread Alan Gauld
"Karim Liateni" wrote def getLines(file): try: lines = open(filename).readlines() ; return lines except IOError: #handle error but in the second 'lines = open(filename).readlines()' I don't hold indirectly a reference to the file? Please, could you explain more this point? Sure, the l

Re: [Tutor] OOD - Another class question

2010-02-28 Thread Alan Gauld
"James Reynolds" wrote parent class and two child classes. Some stuff is done to the object that is passed to the function in one of the child classes and this then calls a function from the global class passing local variables (from the child class). You really need to tighten up on the te

Re: [Tutor] Verifying My Troublesome Linkage Claim between Python and Win7

2010-02-28 Thread Wayne Watson
I just posted the details a moment ago to Steven. On 2/28/2010 3:46 AM, Dave Angel wrote: Wayne Watson wrote: You tell us to "try this" and give a folder structure: Folder1 track1.py data1.txt data2.txt data3.txt Folder2 track1.py dset1.txt dset2.txt

Re: [Tutor] Top posters for 2009

2010-02-28 Thread Christian Witts
Kent Johnson wrote: It's not really about keeping score :-), but once again I've compiled a list of the top 20 posters to the tutor list for the last year. For 2009, the rankings are 2009 (7730 posts, 709 posters) Alan Gauld 969 (12.5%) Kent Johnson 804 (10.4%) Dave Angel 254 (3.3%) spir 25

Re: [Tutor] Verifying My Troublesome ...+Properties

2010-02-28 Thread Dave Angel
Wayne Watson wrote: (I sent the msg below to Steven and the list a moment ago, since msgs going to the list with attachments either don't post or take lots of time to post, I'm sending both of you this copy.) Steven, attached are three jpg files showing the properties of the two py files. The