Re: [Tutor] Help with iterators

2013-03-27 Thread Matthew Johnson
Dear list, Sorry for the delay -- it has taken some time for me to get these emails. It appears i made some dumb error when typing out the description. Mitya Sirenef was correct to ignore my words and to focus on my code. Thanks for your help. I may ask again / for more help when i feel i have

Re: [Tutor] Modules

2013-03-27 Thread eryksun
On Wed, Mar 27, 2013 at 5:09 PM, Alan Gauld wrote: > > Tkinter is an unusual module in that it requires support for Tcl/Tk to be > compiled into the interpreter. This is not always the case. The _tkinter module is a C extension that links to Tcl/Tk. On Debian Linux, _tkinter (_tkinter.so) is in t

Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-27 Thread Amit Saha
On Wed, Mar 27, 2013 at 11:05 PM, Sean Carolan wrote: > >> But, where did you get the idea that you could build Python RPMs using >> $python setup.py bdist_rpm ? I thought that was only limited to >> building RPMs for python packages (including extensions), but not the >> Python interpreter itself

Re: [Tutor] IndexError: index out of bounds

2013-03-27 Thread Peter Otten
Sayan Chatterjee wrote: > Yes, when handled as a numpy array, it's working fine! > > Traceback (most recent call last): > File "ZA.py", line 59, in > if temp_za == j: > ValueError: The truth value of an array with more than one element is > ambiguous. Use a.any() or a.all() >From the atta

Re: [Tutor] Modules

2013-03-27 Thread Alan Gauld
On 27/03/13 19:34, Cor Heisterkamp wrote: My problem starts with the chapter "Introduction to Modules". The first line in the program is: from tkinter import * and here I'm getting an error: ImportError: No module named tkinter Thats an unfortunate exampole the author has chosen.

Re: [Tutor] Modules

2013-03-27 Thread Joel Goldstick
On Wed, Mar 27, 2013 at 4:12 PM, Mark Lawrence wrote: > On 27/03/2013 19:34, Cor Heisterkamp wrote: > >> Hi, >> >> I just started with Python and found a course named "Python programming" >> by Jody S. Gunther. >> My problem starts with the chapter "Introduction to Modules". >> The first line in t

Re: [Tutor] Modules

2013-03-27 Thread Mark Lawrence
On 27/03/2013 19:34, Cor Heisterkamp wrote: Hi, I just started with Python and found a course named "Python programming" by Jody S. Gunther. My problem starts with the chapter "Introduction to Modules". The first line in the program is: from tkinter import * and here I'm getting an error:

Re: [Tutor] Modules

2013-03-27 Thread Danny Yoo
> I just started with Python and found a course named "Python programming" by > Jody S. Gunther. > My problem starts with the chapter "Introduction to Modules". > The first line in the program is: > from tkinter import * > and here I'm getting an error: > ImportError: No module named tkin

[Tutor] Modules

2013-03-27 Thread Cor Heisterkamp
Hi, I just started with Python and found a course named "Python programming" by Jody S. Gunther. My problem starts with the chapter "Introduction to Modules". The first line in the program is: from tkinter import * and here I'm getting an error: ImportError: No module named tkinter What

Re: [Tutor] IndexError: index out of bounds

2013-03-27 Thread Sayan Chatterjee
Hi Peter, Thanks!! Yes, when handled as a numpy array, it's working fine! Traceback (most recent call last): File "ZA.py", line 59, in if temp_za == j: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() This error occurs when the temp_

Re: [Tutor] IndexError: index out of bounds

2013-03-27 Thread Alan Gauld
On 27/03/13 17:36, Sayan Chatterjee wrote: 2) Traceback (most recent call last): File "ZA.py", line 43, in if p_za[i] > 4.0: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() This implies that p_za[i] is actually an array. So maybe

Re: [Tutor] IndexError: index out of bounds

2013-03-27 Thread Peter Otten
Sayan Chatterjee wrote: > Hi Walter, > Thanks a lot! > > Yes, now I get your point. append is working perfectly fine. > > Hi Peter: > > Exactly. It's very nice. Indices needn't have to be mentioned explicitly. > No explicit looping and the thing is done! > > But I have a question, whenever we

Re: [Tutor] IndexError: index out of bounds

2013-03-27 Thread Sayan Chatterjee
Hi Walter, Thanks a lot! Yes, now I get your point. append is working perfectly fine. Hi Peter: Exactly. It's very nice. Indices needn't have to be mentioned explicitly. No explicit looping and the thing is done! But I have a question, whenever we want to do operations on the individual array e

Re: [Tutor] IndexError: index out of bounds

2013-03-27 Thread Peter Otten
Sayan Chatterjee wrote: > When trying to print or assign array elements, getting the following > error: > > Traceback (most recent call last): > File "ZA.py", line 32, in > p_za[i] = p_initial[i] + t*K*cos(K*p_initial[i]); > IndexError: index out of bounds > > I am using Numpy, is it due

Re: [Tutor] IndexError: index out of bounds

2013-03-27 Thread Walter Prins
Hi Sayan, On 27 March 2013 16:31, Sayan Chatterjee wrote: > p_za = [None]*N is not giving away the error message. > > for i in range(0,N): > p_za.append = p_initial[i] + t*K*cos(K*p_initial[i]); is also not > working. > append() is a method, so using append you want something like: for i i

Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Peter Otten
Sayan Chatterjee wrote: > for t in range(0,200): > fname = 'file_' + str(t) > > So it will assign fname values file_0, file_1 so on. Dropping the quotes > is giving me > > IOError: [Errno 2] No such file or directory: 'file_0' > > > Indeed the file is not present. In C we write,if we have to

Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Sayan Chatterjee
Oh yes, thanks. That worked. :) On 27 March 2013 21:58, Bod Soutar wrote: > You were opening the file for reading, rather than writing. It > therefore was expecting to find a file. > Change > fo = open('fname','r+') > to > fo = open('fname','w') > > Bodsda > > On 27 March 2013 16:17, Sayan Chat

Re: [Tutor] IndexError: index out of bounds

2013-03-27 Thread Sayan Chatterjee
p_za = [None]*N is not giving away the error message. for i in range(0,N): p_za.append = p_initial[i] + t*K*cos(K*p_initial[i]); is also not working. Could you please redirect me to a link where the example is demonstrated? What is the simplest way to assign an array element a value? i.e the

Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Bod Soutar
You were opening the file for reading, rather than writing. It therefore was expecting to find a file. Change fo = open('fname','r+') to fo = open('fname','w') Bodsda On 27 March 2013 16:17, Sayan Chatterjee wrote: > for t in range(0,200): > fname = 'file_' + str(t) > > So it will assign fname

Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Sayan Chatterjee
Putting "w" instead of "r+" probably solves the problem. The error is not showing now. On 27 March 2013 21:47, Sayan Chatterjee wrote: > for t in range(0,200): > fname = 'file_' + str(t) > > So it will assign fname values file_0, file_1 so on. Dropping the quotes > is giving me > > IOError: [

Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Sayan Chatterjee
for t in range(0,200): fname = 'file_' + str(t) So it will assign fname values file_0, file_1 so on. Dropping the quotes is giving me IOError: [Errno 2] No such file or directory: 'file_0' Indeed the file is not present. In C we write,if we have to record data in a file FILE *fp fp = fopen(

Re: [Tutor] IndexError: index out of bounds

2013-03-27 Thread Walter Prins
Hi, On 27 March 2013 15:50, Sayan Chatterjee wrote: > Dear all, > > When trying to print or assign array elements, getting the following error: > > Traceback (most recent call last): > File "ZA.py", line 32, in > p_za[i] = p_initial[i] + t*K*cos(K*p_initial[i]); > IndexError: index out o

Re: [Tutor] IndexError: index out of bounds

2013-03-27 Thread Joel Goldstick
On Wed, Mar 27, 2013 at 11:50 AM, Sayan Chatterjee < sayanchatter...@gmail.com> wrote: > Dear all, > > When trying to print or assign array elements, getting the following error: > > Traceback (most recent call last): > File "ZA.py", line 32, in > p_za[i] = p_initial[i] + t*K*cos(K*p_initia

Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Walter Prins
Hello, On 27 March 2013 15:59, Sayan Chatterjee wrote: > Hi Amit, > > fo = fopen('fname','r+') > fo.write("%d %d",j,counter) > > > Is giving the following error: > > File "ZA.py", line 30, in > fo = open('fname','r+') > IOError: [Errno 2] No such file or directory: 'fname' > > Where is th

Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Joel Goldstick
On Wed, Mar 27, 2013 at 11:59 AM, Sayan Chatterjee < sayanchatter...@gmail.com> wrote: > Hi Amit, > > fo = fopen('fname','r+') > fo.write("%d %d",j,counter) > > > Is giving the following error: > > File "ZA.py", line 30, in > fo = open('fname','r+') > IOError: [Errno 2] No such file or dire

Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Sayan Chatterjee
Hi Amit, fo = fopen('fname','r+') fo.write("%d %d",j,counter) Is giving the following error: File "ZA.py", line 30, in fo = open('fname','r+') IOError: [Errno 2] No such file or directory: 'fname' Where is the mistake? Cheers, Sayan On 27 March 2013 12:20, Amit Saha wrote: > On

[Tutor] IndexError: index out of bounds

2013-03-27 Thread Sayan Chatterjee
Dear all, When trying to print or assign array elements, getting the following error: Traceback (most recent call last): File "ZA.py", line 32, in p_za[i] = p_initial[i] + t*K*cos(K*p_initial[i]); IndexError: index out of bounds I am using Numpy, is it due to that? I am attaching the code

Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-27 Thread Sean Carolan
> But, where did you get the idea that you could build Python RPMs using > $python setup.py bdist_rpm ? I thought that was only limited to > building RPMs for python packages (including extensions), but not the > Python interpreter itself. Please correct me if i am wrong. > Ok, so it's only for mo