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

2010-02-28 Thread Alan Gauld
Wayne Watson sierra_mtnv...@sbcglobal.net 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

[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 -- --

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

2010-02-28 Thread Dave Angel
Wayne Watson wrote: snip 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 snip Maybe one simple test at a time will get better responses.

[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

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

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

2010-02-28 Thread Alan Gauld
Karim Liateni karim.liat...@free.fr 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

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 try:

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 above at

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 I'm not sure these functions add enough

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 I'm

[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

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 computing.acco...@googlemail.com 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,

[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

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

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

2010-02-28 Thread Alan Gauld
Karim Liateni karim.liat...@free.fr 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

Re: [Tutor] OOD - Another class question

2010-02-28 Thread Alan Gauld
James Reynolds eire1...@gmail.com 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