[Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Sayan Chatterjee
Dear All,

I am a newbie to Python but have a fair know how of other languages i.e C
etc.

I want to run an astrophysical simulation in Python. All I have to do it to
generate a set of 'plots' depending on a varying parameter and then stitch
them up.

1) Is it possible to automatically generate different data files( say in
the orders of 1000) with different names depending on a parameter?

2) Is it possible to plot the data sets right from Python itself and save
the plots in different jpeg files to stitched upon later on.

Awaiting your reply.

Thank you in advance.

Sincerely,
Sayan

-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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

2013-03-27 Thread Amit Saha
Hi Sayan,

On Wed, Mar 27, 2013 at 4:14 PM, Sayan Chatterjee
sayanchatter...@gmail.com wrote:
 Dear All,

 I am a newbie to Python but have a fair know how of other languages i.e C
 etc.

 I want to run an astrophysical simulation in Python. All I have to do it to
 generate a set of 'plots' depending on a varying parameter and then stitch
 them up.

 1) Is it possible to automatically generate different data files( say in the
 orders of 1000) with different names depending on a parameter?

It certainly is. Are you talking about the file names being
file_1001.txt, file_1002.txt and so on? If yes, let's say  your
parameter values are stored in param. Then something like this would
do the trick:

param_values = [1000,1001, 1005, 2001]

for param in param_values:
fname = 'file_' + str(param)


   # write to file fname
   #
   #


Sorry if its different from what you are looking for. But yes, its
certainly possible.



 2) Is it possible to plot the data sets right from Python itself and save
 the plots in different jpeg files to stitched upon later on.

It is possible to generate plots and save each as JPEGs. [1].

What do you mean by stitching together?

[1] http://stackoverflow.com/questions/8827016/matplotlib-savefig-in-jpeg-format


Best,
Amit
-- 
http://amitsaha.github.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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

2013-03-27 Thread Amit Saha
On Wed, Mar 27, 2013 at 4:23 PM, Amit Saha amitsaha...@gmail.com wrote:
 Hi Sayan,

 On Wed, Mar 27, 2013 at 4:14 PM, Sayan Chatterjee
 sayanchatter...@gmail.com wrote:
 Dear All,

 I am a newbie to Python but have a fair know how of other languages i.e C
 etc.

 I want to run an astrophysical simulation in Python. All I have to do it to
 generate a set of 'plots' depending on a varying parameter and then stitch
 them up.

 1) Is it possible to automatically generate different data files( say in the
 orders of 1000) with different names depending on a parameter?

 It certainly is. Are you talking about the file names being
 file_1001.txt, file_1002.txt and so on? If yes, let's say  your
 parameter values are stored in param. Then something like this would
 do the trick:

 param_values = [1000,1001, 1005, 2001]

 for param in param_values:
 fname = 'file_' + str(param)


# write to file fname
#
#


 Sorry if its different from what you are looking for. But yes, its
 certainly possible.



 2) Is it possible to plot the data sets right from Python itself and save
 the plots in different jpeg files to stitched upon later on.

 It is possible to generate plots and save each as JPEGs. [1].

 What do you mean by stitching together?

You probably meant creating an animation from them. Yes,  it is
certainly possible. I will try to find a link which makes it really
easy to create an animation out of a bunch of images. Which operating
system are you on?

-Amit.



-- 
http://amitsaha.github.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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

2013-03-27 Thread Sayan Chatterjee
Thanks a lot for your prompt reply.

1. Yes. This is exactly what I wanted. Creating a bunch of data sets and
then writing script to plot them using gnuplot, but if something can
produce directly 'plots' it will certainly be helpful.

2. Yes. By stitching them up I meant an animation.Sorry for the
ambiguity. Exactly how we can do it Octave.

Pls see this link:
http://www.krizka.net/2009/11/06/creating-animations-with-octave/

I think Python is THE language, which may come to an immediate rescue.

My OS is Linux Mint (Gnome 3)

Sayan


On 27 March 2013 11:57, Amit Saha amitsaha...@gmail.com wrote:

 On Wed, Mar 27, 2013 at 4:23 PM, Amit Saha amitsaha...@gmail.com wrote:
  Hi Sayan,
 
  On Wed, Mar 27, 2013 at 4:14 PM, Sayan Chatterjee
  sayanchatter...@gmail.com wrote:
  Dear All,
 
  I am a newbie to Python but have a fair know how of other languages i.e
 C
  etc.
 
  I want to run an astrophysical simulation in Python. All I have to do
 it to
  generate a set of 'plots' depending on a varying parameter and then
 stitch
  them up.
 
  1) Is it possible to automatically generate different data files( say
 in the
  orders of 1000) with different names depending on a parameter?
 
  It certainly is. Are you talking about the file names being
  file_1001.txt, file_1002.txt and so on? If yes, let's say  your
  parameter values are stored in param. Then something like this would
  do the trick:
 
  param_values = [1000,1001, 1005, 2001]
 
  for param in param_values:
  fname = 'file_' + str(param)
 
 
 # write to file fname
 #
 #
 
 
  Sorry if its different from what you are looking for. But yes, its
  certainly possible.
 
 
 
  2) Is it possible to plot the data sets right from Python itself and
 save
  the plots in different jpeg files to stitched upon later on.
 
  It is possible to generate plots and save each as JPEGs. [1].
 
  What do you mean by stitching together?

 You probably meant creating an animation from them. Yes,  it is
 certainly possible. I will try to find a link which makes it really
 easy to create an animation out of a bunch of images. Which operating
 system are you on?

 -Amit.



 --
 http://amitsaha.github.com/




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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

2013-03-27 Thread Amit Saha
On Wed, Mar 27, 2013 at 4:36 PM, Sayan Chatterjee
sayanchatter...@gmail.com wrote:
 Thanks a lot for your prompt reply.

 1. Yes. This is exactly what I wanted. Creating a bunch of data sets and
 then writing script to plot them using gnuplot, but if something can produce
 directly 'plots' it will certainly be helpful.

Yes, indeed it is possible. You may want to explore matplotlib a bit.
You can start with this tutorial [1].

[1] http://www.loria.fr/~rougier/teaching/matplotlib/


 2. Yes. By stitching them up I meant an animation.Sorry for the ambiguity.
 Exactly how we can do it Octave.

 Pls see this link:
 http://www.krizka.net/2009/11/06/creating-animations-with-octave/

Right, yes, if you see it uses mencoder/ffmpeg to create the
animation. So, if you save your individual plots and then use one of
these tools, you should be able to get the animation done.

Matplotlib itself seems to have some Animated plotting capabilities,
but I haven't had any experience with them.


Best,
Amit.


-- 
http://amitsaha.github.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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

2013-03-27 Thread Sayan Chatterjee
Yes, ffmpeg will do if multiple plots can be generated using mathplotlib .
I'll look up the links you provided and get back to you, if I can't figure
it out. :)




On 27 March 2013 12:12, Amit Saha amitsaha...@gmail.com wrote:

 On Wed, Mar 27, 2013 at 4:36 PM, Sayan Chatterjee
 sayanchatter...@gmail.com wrote:
  Thanks a lot for your prompt reply.
 
  1. Yes. This is exactly what I wanted. Creating a bunch of data sets and
  then writing script to plot them using gnuplot, but if something can
 produce
  directly 'plots' it will certainly be helpful.

 Yes, indeed it is possible. You may want to explore matplotlib a bit.
 You can start with this tutorial [1].

 [1] http://www.loria.fr/~rougier/teaching/matplotlib/

 
  2. Yes. By stitching them up I meant an animation.Sorry for the
 ambiguity.
  Exactly how we can do it Octave.
 
  Pls see this link:
  http://www.krizka.net/2009/11/06/creating-animations-with-octave/

 Right, yes, if you see it uses mencoder/ffmpeg to create the
 animation. So, if you save your individual plots and then use one of
 these tools, you should be able to get the animation done.

 Matplotlib itself seems to have some Animated plotting capabilities,
 but I haven't had any experience with them.


 Best,
 Amit.


 --
 http://amitsaha.github.com/




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 module distributions?  I assumed it could package
Python itself as well, because it creates a *.spec file that reads like
this:

%define name Python
%define version 2.7.3
%define unmangled_version 2.7.3
%define release 1

Summary: A high-level object-oriented programming language


 Okay, here is something for you to try in the meantime. Download the
 Python 2.7 SRPM (source RPM) from
 http://koji.fedoraproject.org/koji/packageinfo?packageID=130. May be
 the F17 version.
 Extract it to get the source files, patches and the SPEC file.


Thank you, I will try this today.  In the meantime I have started a thread
on the distutils mailing list, so as not to spam Tutor with my build
woes.

regards,

Sean
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[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 module
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 herewith.



-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org


ZA.py
Description: Binary data
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 module
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 amitsaha...@gmail.com wrote:

 On Wed, Mar 27, 2013 at 4:49 PM, Sayan Chatterjee
 sayanchatter...@gmail.com wrote:
  Yes, ffmpeg will do if multiple plots can be generated using mathplotlib
 .
  I'll look up the links you provided and get back to you, if I can't
 figure
  it out. :)

 Sure, good luck! :)

 
 
 
 
  On 27 March 2013 12:12, Amit Saha amitsaha...@gmail.com wrote:
 
  On Wed, Mar 27, 2013 at 4:36 PM, Sayan Chatterjee
  sayanchatter...@gmail.com wrote:
   Thanks a lot for your prompt reply.
  
   1. Yes. This is exactly what I wanted. Creating a bunch of data sets
 and
   then writing script to plot them using gnuplot, but if something can
   produce
   directly 'plots' it will certainly be helpful.
 
  Yes, indeed it is possible. You may want to explore matplotlib a bit.
  You can start with this tutorial [1].
 
  [1] http://www.loria.fr/~rougier/teaching/matplotlib/
 
  
   2. Yes. By stitching them up I meant an animation.Sorry for the
   ambiguity.
   Exactly how we can do it Octave.
  
   Pls see this link:
   http://www.krizka.net/2009/11/06/creating-animations-with-octave/
 
  Right, yes, if you see it uses mencoder/ffmpeg to create the
  animation. So, if you save your individual plots and then use one of
  these tools, you should be able to get the animation done.
 
  Matplotlib itself seems to have some Animated plotting capabilities,
  but I haven't had any experience with them.
 
 
  Best,
  Amit.
 
 
  --
  http://amitsaha.github.com/
 
 
 
 
  --
 
 
 
 --
  Sayan  Chatterjee
  Dept. of Physics and Meteorology
  IIT Kharagpur
  Lal Bahadur Shastry Hall of Residence
  Room AB 205
  Mob: +91 9874513565
  blog: www.blissprofound.blogspot.com
 
  Volunteer , Padakshep
  www.padakshep.org



 --
 http://amitsaha.github.com/




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 module
 fo = open('fname','r+')
 IOError: [Errno 2] No such file or directory: 'fname'

 Where is the mistake?


Where is the file called 'fname'?  It must exist and  be in the current
directory


 Cheers,
 Sayan






 On 27 March 2013 12:20, Amit Saha amitsaha...@gmail.com wrote:

 On Wed, Mar 27, 2013 at 4:49 PM, Sayan Chatterjee
 sayanchatter...@gmail.com wrote:
  Yes, ffmpeg will do if multiple plots can be generated using
 mathplotlib .
  I'll look up the links you provided and get back to you, if I can't
 figure
  it out. :)

 Sure, good luck! :)


 
 
 
 
  On 27 March 2013 12:12, Amit Saha amitsaha...@gmail.com wrote:
 
  On Wed, Mar 27, 2013 at 4:36 PM, Sayan Chatterjee
  sayanchatter...@gmail.com wrote:
   Thanks a lot for your prompt reply.
  
   1. Yes. This is exactly what I wanted. Creating a bunch of data sets
 and
   then writing script to plot them using gnuplot, but if something can
   produce
   directly 'plots' it will certainly be helpful.
 
  Yes, indeed it is possible. You may want to explore matplotlib a bit.
  You can start with this tutorial [1].
 
  [1] http://www.loria.fr/~rougier/teaching/matplotlib/
 
  
   2. Yes. By stitching them up I meant an animation.Sorry for the
   ambiguity.
   Exactly how we can do it Octave.
  
   Pls see this link:
   http://www.krizka.net/2009/11/06/creating-animations-with-octave/
 
  Right, yes, if you see it uses mencoder/ffmpeg to create the
  animation. So, if you save your individual plots and then use one of
  these tools, you should be able to get the animation done.
 
  Matplotlib itself seems to have some Animated plotting capabilities,
  but I haven't had any experience with them.
 
 
  Best,
  Amit.
 
 
  --
  http://amitsaha.github.com/
 
 
 
 
  --
 
 
 
 --
  Sayan  Chatterjee
  Dept. of Physics and Meteorology
  IIT Kharagpur
  Lal Bahadur Shastry Hall of Residence
  Room AB 205
  Mob: +91 9874513565
  blog: www.blissprofound.blogspot.com
 
  Volunteer , Padakshep
  www.padakshep.org



 --
 http://amitsaha.github.com/




 --


 --
 *Sayan  Chatterjee*
 Dept. of Physics and Meteorology
 IIT Kharagpur
 Lal Bahadur Shastry Hall of Residence
 Room AB 205
 Mob: +91 9874513565
 blog: www.blissprofound.blogspot.com

 Volunteer , Padakshep
 www.padakshep.org

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor




-- 
Joel Goldstick
http://joelgoldstick.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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

2013-03-27 Thread Walter Prins
Hello,

On 27 March 2013 15:59, 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 module
 fo = open('fname','r+')
 IOError: [Errno 2] No such file or directory: 'fname'

 Where is the mistake?


You are trying to open a file named literally fname due to putting it in
quotes, you probably want to drop the quotes.

Walter
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 module
 p_za[i] = p_initial[i] + t*K*cos(K*p_initial[i]);


You declare p_za = [] above.  So there is no p_za[i].  You should use
append since you are adding elements to the end of the list.

 IndexError: index out of bounds

 I am using Numpy, is it due to that? I am attaching the code herewith.



 --


 --
 *Sayan  Chatterjee*
 Dept. of Physics and Meteorology
 IIT Kharagpur
 Lal Bahadur Shastry Hall of Residence
 Room AB 205
 Mob: +91 9874513565
 blog: www.blissprofound.blogspot.com

 Volunteer , Padakshep
 www.padakshep.org

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor




-- 
Joel Goldstick
http://joelgoldstick.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] IndexError: index out of bounds

2013-03-27 Thread Walter Prins
Hi,


On 27 March 2013 15:50, 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 module
 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 herewith.


Not Numpy no.  The p_za list appears to be empty at the point where the
above assgnment to p_za[i] is done, hence you get the IndexError message.
 You should initialise p_za to be as long as needed first.  Maybe by simply
using p_za = [None] * N instead of assigning [], or alternately perhaps by
appending instead at the point where you first reference p_ze[i].

Walter
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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(file.dat,w)


Here I want to write different data sets in files having different name i.e
I want to create the files with the data sets. I am quite new to Python, so
you can assume zero knowledge while answering. Thanks for your support. :)


On 27 March 2013 21:38, Walter Prins wpr...@gmail.com wrote:

 Hello,

 On 27 March 2013 15:59, Sayan Chatterjee sayanchatter...@gmail.comwrote:

 Hi Amit,

 fo = fopen('fname','r+')
 fo.write(%d   %d,j,counter)


 Is giving the following error:

 File ZA.py, line 30, in module
 fo = open('fname','r+')
 IOError: [Errno 2] No such file or directory: 'fname'

 Where is the mistake?


 You are trying to open a file named literally fname due to putting it in
 quotes, you probably want to drop the quotes.

 Walter




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 sayanchatter...@gmail.com 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 record data in
 a file

 FILE *fp

 fp = fopen(file.dat,w)


 Here I want to write different data sets in files having different name
 i.e I want to create the files with the data sets. I am quite new to
 Python, so you can assume zero knowledge while answering. Thanks for your
 support. :)


 On 27 March 2013 21:38, Walter Prins wpr...@gmail.com wrote:

 Hello,

 On 27 March 2013 15:59, Sayan Chatterjee sayanchatter...@gmail.comwrote:

 Hi Amit,

 fo = fopen('fname','r+')
 fo.write(%d   %d,j,counter)


 Is giving the following error:

 File ZA.py, line 30, in module
 fo = open('fname','r+')
 IOError: [Errno 2] No such file or directory: 'fname'

 Where is the mistake?


 You are trying to open a file named literally fname due to putting it
 in quotes, you probably want to drop the quotes.

 Walter




 --


 --
 *Sayan  Chatterjee*
 Dept. of Physics and Meteorology
 IIT Kharagpur
 Lal Bahadur Shastry Hall of Residence
 Room AB 205
 Mob: +91 9874513565
 blog: www.blissprofound.blogspot.com

 Volunteer , Padakshep
 www.padakshep.org




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 sayanchatter...@gmail.com 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 record data in a
 file

 FILE *fp

 fp = fopen(file.dat,w)


 Here I want to write different data sets in files having different name i.e
 I want to create the files with the data sets. I am quite new to Python, so
 you can assume zero knowledge while answering. Thanks for your support. :)


 On 27 March 2013 21:38, Walter Prins wpr...@gmail.com wrote:

 Hello,

 On 27 March 2013 15:59, 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 module
 fo = open('fname','r+')
 IOError: [Errno 2] No such file or directory: 'fname'

 Where is the mistake?


 You are trying to open a file named literally fname due to putting it in
 quotes, you probably want to drop the quotes.

 Walter




 --


 --
 Sayan  Chatterjee
 Dept. of Physics and Meteorology
 IIT Kharagpur
 Lal Bahadur Shastry Hall of Residence
 Room AB 205
 Mob: +91 9874513565
 blog: www.blissprofound.blogspot.com

 Volunteer , Padakshep
 www.padakshep.org

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 C analogue of:

int array[200]

for(i=0;i200;i++)
  array[i] = 2*i + 5;






On 27 March 2013 21:44, Walter Prins wpr...@gmail.com wrote:

 Hi,


 On 27 March 2013 15:50, Sayan Chatterjee sayanchatter...@gmail.comwrote:

 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 module
 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 herewith.


  Not Numpy no.  The p_za list appears to be empty at the point where the
 above assgnment to p_za[i] is done, hence you get the IndexError message.
  You should initialise p_za to be as long as needed first.  Maybe by simply
 using p_za = [None] * N instead of assigning [], or alternately perhaps by
 appending instead at the point where you first reference p_ze[i].

 Walter



 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 bod...@googlemail.com 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 Chatterjee sayanchatter...@gmail.com
 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 record data
 in a
  file
 
  FILE *fp
 
  fp = fopen(file.dat,w)
 
 
  Here I want to write different data sets in files having different name
 i.e
  I want to create the files with the data sets. I am quite new to Python,
 so
  you can assume zero knowledge while answering. Thanks for your support.
 :)
 
 
  On 27 March 2013 21:38, Walter Prins wpr...@gmail.com wrote:
 
  Hello,
 
  On 27 March 2013 15:59, 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 module
  fo = open('fname','r+')
  IOError: [Errno 2] No such file or directory: 'fname'
 
  Where is the mistake?
 
 
  You are trying to open a file named literally fname due to putting it
 in
  quotes, you probably want to drop the quotes.
 
  Walter
 
 
 
 
  --
 
 
 
 --
  Sayan  Chatterjee
  Dept. of Physics and Meteorology
  IIT Kharagpur
  Lal Bahadur Shastry Hall of Residence
  Room AB 205
  Mob: +91 9874513565
  blog: www.blissprofound.blogspot.com
 
  Volunteer , Padakshep
  www.padakshep.org
 
  ___
  Tutor maillist  -  Tutor@python.org
  To unsubscribe or change subscription options:
  http://mail.python.org/mailman/listinfo/tutor
 




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 record data in
 a file
 
 FILE *fp
 
 fp = fopen(file.dat,w)
 
 
 Here I want to write different data sets in files having different name
 i.e I want to create the files with the data sets. I am quite new to
 Python, so you can assume zero knowledge while answering. Thanks for your
 support. :)

If you try to open a non-existent file in r+ mode in C you should get an 
error, too. The following C code

FILE * f;
int i;
char filename[100];

for (i=0; i10; i++) {
sprintf(filename, foo%d.dat, i);
FILE * f = fopen(filename, w);
/* write stuff to file */
...
fclose(f);
}

translates into this piece of Python:

for i in range(10):
filename = foo%d.dat % i
with open(filename, w) as f:
# write stuff to file
...


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] IndexError: index out of bounds

2013-03-27 Thread Walter Prins
Hi Sayan,

On 27 March 2013 16:31, Sayan Chatterjee sayanchatter...@gmail.com 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 in range(0,N):
p_za.append( p_initial[i] + t*K*cos(K*p_initial[i]) );

After every loop iteration, the list grows by having one item appended to
it, being the result of the expression: p_initial[i] +
t*K*cos(K*p_initial[i])


 Could you please redirect me to a link where the example is demonstrated?


http://courses.cms.caltech.edu/cs11/material/python/misc/python_idioms.html

See the paragraph on Sequence multiplication.



 What is the simplest way to assign an array element a value?


What you have is fine for assignment to a particular slot in the list.
What you've missed and has already been pointed out, is to initialise/set
the length of your list first, before trying to set the value of arbitrary
slots.  In the C example you posted the array is declared with length 200
up front.  In your Python code however you assign [], which is a list of
length 0.   By contrast, the expression I gave you before, e.g. [None] * N,
generates a list of length N, with each element in the list being the None
object, thus initialising the list, ensuring that you can later assign to
arbitrary slots when needed.

Walter
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 module
 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 herewith.

If you are using numpy it is likely that you don't need to loop over the 
index explicitly. Assuming t and K are scalars, and p_initial is a numpy 
array you can write

p_za = p_initial + t * K * numpy.cos(K*p_initial)

For example:

 import numpy
 p_initial = numpy.array([1.2, 3.4, 5.6])
 t = 1.1
 K = 2.2
 p_initial + t*K*numpy.cos(K*p_initial)
array([-0.92189929,  4.28408588,  7.94692559])

Quite powerful, once you get the knack of it.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 elements, don't we have to mention the indices explicitly i.e p_za[i]?

1) Traceback (most recent call last):
  File ZA.py, line 44, in module
p_za = p_za % 4
TypeError: unsupported operand type(s) for %: 'list' and 'int'



2) Traceback (most recent call last):
  File ZA.py, line 43, in module
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()

When the i indices are removed * (1) * error message is showing up and when
i is included *(2) *is shown.* *








On 27 March 2013 22:29, Walter Prins wpr...@gmail.com wrote:

 Hi Sayan,

 On 27 March 2013 16:31, Sayan Chatterjee sayanchatter...@gmail.comwrote:

 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 in range(0,N):
 p_za.append( p_initial[i] + t*K*cos(K*p_initial[i]) );

 After every loop iteration, the list grows by having one item appended to
 it, being the result of the expression: p_initial[i] +
 t*K*cos(K*p_initial[i])


 Could you please redirect me to a link where the example is demonstrated?


 http://courses.cms.caltech.edu/cs11/material/python/misc/python_idioms.html

 See the paragraph on Sequence multiplication.



 What is the simplest way to assign an array element a value?


 What you have is fine for assignment to a particular slot in the list.
 What you've missed and has already been pointed out, is to initialise/set
 the length of your list first, before trying to set the value of arbitrary
 slots.  In the C example you posted the array is declared with length 200
 up front.  In your Python code however you assign [], which is a list of
 length 0.   By contrast, the expression I gave you before, e.g. [None] * N,
 generates a list of length N, with each element in the list being the None
 object, thus initialising the list, ensuring that you can later assign to
 arbitrary slots when needed.

 Walter






-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 want to do operations on the individual
 array elements, don't we have to mention the indices explicitly i.e
 p_za[i]?

For Python's built-in list, yes, but not for numpy arrays.
 
 1) Traceback (most recent call last):
   File ZA.py, line 44, in module
 p_za = p_za % 4
 TypeError: unsupported operand type(s) for %: 'list' and 'int'

 items = [3, 4, 5]
 items % 2
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: unsupported operand type(s) for %: 'list' and 'int'
 items = numpy.array(items)
 items % 2
array([1, 0, 1])

Even for lists you can do better than using an explicit index, you can 
iterate over its members:

 items = [3, 4, 5]
 [v % 2 for v in items]
[1, 0, 1]

 2) Traceback (most recent call last):
   File ZA.py, line 43, in module
 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()
 
 When the i indices are removed * (1) * error message is showing up and
 when i is included *(2) *is shown.* *

You are probably seeing that error because p_za[i] is a numpy.array, i. e. 
you have a list of arrays:

 items = [numpy.array([1,2]), numpy.array([3,4])]
 items[0]  4
array([False, False], dtype=bool)
 if items[0]  4: pass
... 
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: The truth value of an array with more than one element is 
ambiguous. Use a.any() or a.all()

How you managed to get there and what you actually want to achieve -- I 
can't tell from what you provide. Perhaps you can give a little more 
context, in code, but more importantly in prose.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 module
 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 p_za is a list (of arrays)?
Try printing it to see.



--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 module
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_za ( a numpy array, print temp_za works
fine) is compared with j. I am attaching the code.

Another question  how do I get an integer value for  p_za / 2 . Type
casting with int says:
TypeError: only length-1 arrays can be converted to Python scalars.




On 27 March 2013 23:37, Alan Gauld alan.ga...@btinternet.com wrote:

 On 27/03/13 17:36, Sayan Chatterjee wrote:

  2) Traceback (most recent call last):
File ZA.py, line 43, in module
  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 p_za is a list (of arrays)?
 Try printing it to see.



 --
 Alan G
 Author of the Learn to Program web site
 http://www.alan-g.me.uk/


 __**_
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org


ZA.py
Description: Binary data
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[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 to do?
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 tkinter


Case matters.  Tkinter should be capitalized.


Best of wishes!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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:
  ImportError: No module named tkinter

What to do?




This works for me with Python 3.3 on Windows Vista.  What OS and Python 
version are you using, as I believe that this was tKinter in Python 2?


--
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.


Mark Lawrence

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Modules

2013-03-27 Thread Joel Goldstick
On Wed, Mar 27, 2013 at 4:12 PM, Mark Lawrence breamore...@yahoo.co.ukwrote:

 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:
   ImportError: No module named tkinter

 What to do?

 google it and you find:  http://wiki.python.org/moin/TkInter


Step 2 - can Tkinter be imported?

Try the correct command for your version at the Python prompt:

 import Tkinter # no underscore, uppercase 'T' for versions prior to V3.0

 import tkinter # no underscore, lowercase 't' for V3.0 and later



 This works for me with Python 3.3 on Windows Vista.  What OS and Python
 version are you using, as I believe that this was tKinter in Python 2?

 --
 If you're using GoogleCrap™ please read this http://wiki.python.org/moin/*
 *GoogleGroupsPython http://wiki.python.org/moin/GoogleGroupsPython.

 Mark Lawrence


 __**_
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/**mailman/listinfo/tutorhttp://mail.python.org/mailman/listinfo/tutor




-- 
Joel Goldstick
http://joelgoldstick.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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.

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.


So there are 3 possible causes of the error:

1) Your python does not have support for Tcl/Tk built in.
Which version of Python and which OS are you using? If your version does 
not support Tcl you need to either build a version from source or find a 
copy for your OS with Tkinter support. The default downloads for MacOS, 
Windows and most Linuxes have it but the OS installed versions often don't.


2) The tutor is aimed at Python v3 but you are using v2
Which version of Python are you running? What does it say
when you start the Python interpreter  prompt?

3) The tutor and you are both on V2 but you mistyped (or it has a typo) 
that says tkinter when it should say Tkinter.


Try typing

import Tkinter


HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 module
 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 attached script:

if temp_za == j:
counter += 1

Do you want to count the entries?

 temp_za = numpy.array([1, 2, 3, 2, 1, 1])
 (temp_za == 1).sum()
3

 This error occurs when the temp_za ( a numpy array, print temp_za works
 fine) is compared with j. I am attaching the code.

I'm sorry, I am lacking the domain knowledge to make sense of it. Just one 
more remark:

[]  0.0

is always False, regardless of the contents of the list

 
 Another question  how do I get an integer value for  p_za / 2 . Type
 casting with int says:
 TypeError: only length-1 arrays can be converted to Python scalars.

I'd use

numpy.array(p_za//2, dtype=int)

but I'm not a numpy expert. As you dig deeper the tutor mailing list may not 
be the best place to ask -- numpy has a dedicated mailing list of its own.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


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 scaro...@gmail.com 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. Please correct me if i am wrong.


 Ok, so it's only for module distributions?  I assumed it could package
 Python itself as well, because it creates a *.spec file that reads like
 this:

 %define name Python
 %define version 2.7.3
 %define unmangled_version 2.7.3
 %define release 1

 Summary: A high-level object-oriented programming language

Hmm. Let's see, it was a guess on my part as well.



 Okay, here is something for you to try in the meantime. Download the
 Python 2.7 SRPM (source RPM) from
 http://koji.fedoraproject.org/koji/packageinfo?packageID=130. May be
 the F17 version.
 Extract it to get the source files, patches and the SPEC file.


 Thank you, I will try this today.  In the meantime I have started a thread
 on the distutils mailing list, so as not to spam Tutor with my build
 woes.

I will follow the thread there and see what comes out of it. This is
interesting!

FWIW, I tried to get the SRPM and build Python 2.7 on RHEL 5. Quickly
realized that it lacks, yum-builddep, yumdownloader, etc :-/

So, just left it there for then. I will have to try again the manual way.


-Amit.

-- 
http://amitsaha.github.com/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Modules

2013-03-27 Thread eryksun
On Wed, Mar 27, 2013 at 5:09 PM, Alan Gauld alan.ga...@btinternet.com 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 the package python-tk /
python3-tk. The ImportError raised by import tkinter suggests the
required package. Except for Python 3.2 it incorrectly suggests the
2.x package:

ImportError: No module named _tkinter, please install the
python-tk package

IIRC the official Python installer on Windows defaults to installing
tkinter, but it is optional.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor