[Tutor] problem with saving data in a text file

2013-04-23 Thread Debashish Saha
I tried the following: Am_cor=np.vectorize(Am_cor) #plt.plot(t, signal, color='blue', label='Original signal') fig=plt.figure() plt.xlabel('Time(minute)') plt.ylabel('$ Re()$') plt.xlim([t[0], t[-1]]) plt.ylim((-.3*a1-a1,a1+.3*a1)) plt.grid() plt.plot(t,Am_cor(t),'o-',label='with parallax', marke

Re: [Tutor] why does this not work

2013-04-23 Thread frederico Batista
Dave, you clearly don't know codecademy. Please be nice to him. Also, I recommend the codecademy forums. They have a lot of material about every exercise. On Apr 23, 2013 11:50 PM, "Dave Angel" wrote: > On 04/23/2013 03:39 PM, Roelof Wobben wrote: > >> Im trying to learn python by a course at cod

Re: [Tutor] trouble installing library

2013-04-23 Thread eryksun
On Tue, Apr 23, 2013 at 11:01 PM, Lolo Lolo wrote: > Scripts\activate.bat ... returns this error: > > 'Scripts' is not recognized as an internal or external command, > operable program or batch file. > it might want a program or command to run the bat fine Scripts\activate.bat is a relative path,

Re: [Tutor] trouble installing library

2013-04-23 Thread Lolo Lolo
>> Run Scripts\activate.bat if your shell is cmd, or Scripts\activate.ps1 >> if you're using PowerShell. These are shell scripts. Do not run them >> with Python. I have to get some sleep but i believe i got the installation in the right version it also insta

Re: [Tutor] why does this not work

2013-04-23 Thread Dave Angel
On 04/23/2013 03:39 PM, Roelof Wobben wrote: Im trying to learn python by a course at codeacademy. Now I have this code : def shut_down(s): s = s.lower() if s == "yes": return "Shutting down..." elif s == "no" : return "Shutdown aborted!" else: retu

Re: [Tutor] trouble installing library

2013-04-23 Thread eryksun
On Tue, Apr 23, 2013 at 5:59 PM, Lolo Lolo wrote: > found the activate file inside a folder name Scripts (instead of bin) and > and tried the same command, but now i get this error: > > File "Scripts/activate", line 4 > deactivate () { > ^ > SyntaxError: invalid syntax Run

Re: [Tutor] trouble installing library

2013-04-23 Thread Alan Gauld
On 23/04/13 22:59, Lolo Lolo wrote: File "Scripts/activate", line 4 deactivate () { ^ SyntaxError: invalid syntax That's a bash/zsh script not a Python one. You will need to find a Windows equivalent bat file or cmd file or maybe wsh. No idea if such a thing exist

Re: [Tutor] trouble installing library

2013-04-23 Thread Lolo Lolo
>> The dot (.) command is used to source a file, It executes Unix like commands >> in bin/activate. Not relevant when  you're on windows. >> Is there a .bat or >> .cmd file instead?   oh i had no idea.. i found the activate file inside a folder name Scripts (instead of bin) and and tried the sam

Re: [Tutor] trouble installing library

2013-04-23 Thread Prasad, Ramit
Lolo Lolo wrote: [snip] > since im on windows i used dir instead of ls, but this line: > > $ . bin/activate > > is not recognised as a command. If i try to open it wth python cmd says no > such file or directory > [snip] Instead of trying `. bin/activate` try `bin/activate` (note the lack of "

Re: [Tutor] trouble installing library

2013-04-23 Thread Albert-Jan Roskam
Subject: Re: [Tutor] trouble installing library > >guys having got the install to work, a part of the process fails me.. the full >code instruction is: >  >$ virtualenv --no-site-packages gmapenv >$ cd gmapenv >$ ls >bin/  include/  lib/ >$ . bin/activate >  >since im on windows i used di

Re: [Tutor] string.Template

2013-04-23 Thread Prasad, Ramit
Albert-Jan Roskam wrote: > > On 24/04/13 00:14, Albert-Jan Roskam wrote: > >> Hello, > >> > >> Is there a better, *built-in* alternative for the code below? The > >> recursion > > works, > >> but it feels like reinventing the wheel. > > > > What makes you think it is reinventing the wheel? > >

Re: [Tutor] trouble installing library

2013-04-23 Thread Lolo Lolo
guys having got the install to work, a part of the process fails me.. the full code instruction is:   $ virtualenv --no-site-packages gmapenv $ cd gmapenv $ ls bin/  include/  lib/ $ . bin/activate   since im on windows i used dir instead of ls, but this line:   $ . bin/activate   is not recog

Re: [Tutor] why does this not work

2013-04-23 Thread Oscar Benjamin
On 23 April 2013 21:17, Danny Yoo wrote: > Hi Roelof, > > On Tue, Apr 23, 2013 at 1:39 PM, Roelof Wobben wrote: >> Im trying to learn python by a course at codeacademy. >> >> Now I have this code : >> >> def shut_down(s): >> s = s.lower() >> if s == "yes": >> return "Shutting down

Re: [Tutor] trouble installing library

2013-04-23 Thread Lolo Lolo
Thanks for your response guys:   >> what happens if you cd to the directory where you untarred the file, then >> run "python setup.py install"   This seems to have done the trick!   >> It's an honour to be communicating with the world's last Vista user ;-)))   lol And this was very uncalled for

Re: [Tutor] why does this not work

2013-04-23 Thread Danny Yoo
Hi Roelof, On Tue, Apr 23, 2013 at 1:39 PM, Roelof Wobben wrote: > Im trying to learn python by a course at codeacademy. > > Now I have this code : > > def shut_down(s): > s = s.lower() > if s == "yes": > return "Shutting down..." > elif s == "no" : > return "Shutdown

Re: [Tutor] why does this not work

2013-04-23 Thread Mark Lawrence
On 23/04/2013 20:39, Roelof Wobben wrote: Im trying to learn python by a course at codeacademy. Now I have this code : def shut_down(s): s = s.lower() if s == "yes": return "Shutting down..." elif s == "no" : return "Shutdown aborted!" else: return

Re: [Tutor] trouble installing library

2013-04-23 Thread Albert-Jan Roskam
ImportError: No module named virtualenv > >what happens if you cd to the directory where you untarred the file, then run >"python setup.py install"Did you download the right version (for Python3)? >Am i installing it correctly? can anyone offer any help? Im on Windows Vista, >and i have both pyt

Re: [Tutor] trouble installing library

2013-04-23 Thread Danny Yoo
According to the documentation in: http://www.virtualenv.org/en/latest/ and: https://pypi.python.org/pypi/virtualenv the "Installation" section in the documentation walks through what you need to do to install the software. Can you use Python's package managment system "pip" to handle

[Tutor] trouble installing library

2013-04-23 Thread Lolo Lolo
im not sure if anyone is familiar with virtualenv but im tryng to follow a tutorial that has asked me to install virtualenv. i downloaded it in the form of a tar file and extracted it. There was no .exe file to install. The tutorial  asks for me to type this code : $ virtualenv --no-site-package

Re: [Tutor] why does this not work

2013-04-23 Thread Karan Goel
You're missing a dot (.) *Sorry, I didn't understand you.* - Karan Goel The Real Reason Things Keep Going Wrong: At the beginning of time, God set a Magic Top Spinning... and spinning... and spinning... and spinning... and spinning... and spinning... and spinning..

[Tutor] why does this not work

2013-04-23 Thread Roelof Wobben
Im trying to learn python by a course at codeacademy. Now I have this code : def shut_down(s): s = s.lower() if s == "yes": return "Shutting down..." elif s == "no" : return "Shutdown aborted!" else: return "Sorry, I didn't understand you" But when I run

Re: [Tutor] string.Template

2013-04-23 Thread Albert-Jan Roskam
> Subject: Re: [Tutor] string.Template > > On 24/04/13 00:14, Albert-Jan Roskam wrote: >> Hello, >> >> Is there a better, *built-in* alternative for the code below? The recursion > works, >> but it feels like reinventing the wheel. > > What makes you think it is reinventing the wheel? Hi

Re: [Tutor] Why do I get an "unvalid syntax" on the print line for number1

2013-04-23 Thread Don Jennings
On Apr 23, 2013, at 2:19 PM, Chris “Kwpolska” Warrick wrote: > On Sat, Apr 20, 2013 at 10:33 PM, Pat Collins > wrote: >> Any help appreciated. >> >> >> #!/usr/bin/env python >> """ >> number.py Demonstrates collecting a number from the user. >> """ >> >> number_string1 = float(input("Give me

Re: [Tutor] Why do I get an "unvalid syntax" on the print line for number1

2013-04-23 Thread Prasad, Ramit
Pat Collins wrote: > Any help appreciated. > > > #!/usr/bin/env python > """ > number.py Demonstrates collecting a number from the user. > """ > > number_string1 = float(input("Give me a number: ")) > number1 = (number_string1) number_string1 is not a string as you have already converted it to

Re: [Tutor] Why do I get an "unvalid syntax" on the print line for number1

2013-04-23 Thread Mark Lawrence
On 20/04/2013 21:33, Pat Collins wrote: Any help appreciated. #!/usr/bin/env python """ number.py Demonstrates collecting a number from the user. """ number_string1 = float(input("Give me a number: ")) number1 = (number_string1) Why not number1 = float(input("Give me a number: ")) ? numbe

Re: [Tutor] Why do I get an "unvalid syntax" on the print line for number1

2013-04-23 Thread Chris “Kwpolska” Warrick
On Sat, Apr 20, 2013 at 10:33 PM, Pat Collins wrote: > Any help appreciated. > > > #!/usr/bin/env python > """ > number.py Demonstrates collecting a number from the user. > """ > > number_string1 = float(input("Give me a number: ")) > number1 = (number_string1) > > number_string2 = float(input("Gi

[Tutor] Why do I get an "unvalid syntax" on the print line for number1

2013-04-23 Thread Pat Collins
Any help appreciated. #!/usr/bin/env python """ number.py Demonstrates collecting a number from the user. """ number_string1 = float(input("Give me a number: ")) number1 = (number_string1) number_string2 = float(input("Give me another number: ")) number2 = (number_string2) print number1, "time

Re: [Tutor] string.Template

2013-04-23 Thread Steven D'Aprano
On 24/04/13 00:47, Chris “Kwpolska” Warrick wrote: 1. locals() is hacky and you shouldn’t use it. Actually this, or something like this, is exactly one of the use-cases for the locals() function. Using locals() as a read-only mapping of name:value pairs is perfectly safe. It's only unsafe i

Re: [Tutor] string.Template

2013-04-23 Thread Steven D'Aprano
On 24/04/13 00:14, Albert-Jan Roskam wrote: Hello, Is there a better, *built-in* alternative for the code below? The recursion works, but it feels like reinventing the wheel. What makes you think it is reinventing the wheel? The following looks like a perfectly sensible use for recursion. If

Re: [Tutor] string.Template

2013-04-23 Thread Chris “Kwpolska” Warrick
On Tue, Apr 23, 2013 at 4:14 PM, Albert-Jan Roskam wrote: > Hello, > > Is there a better, *built-in* alternative for the code below? The recursion > works, > but it feels like reinventing the wheel. > > import string > > def translate(template, *args): > """Recursively $-substitute using as

[Tutor] string.Template

2013-04-23 Thread Albert-Jan Roskam
Hello, Is there a better, *built-in* alternative for the code below? The recursion works, but it feels like reinventing the wheel. import string def translate(template, *args):     """Recursively $-substitute using as a replacement"""     syntax = string.Template(template).substitute(*args)  

Re: [Tutor] Why is my list index going out of range

2013-04-23 Thread Alan Gauld
On 23/04/13 02:47, Jim Mooney wrote: Okay, what am I doing wrong here? primeList = [1] numList = list(range(2,101)) for e in numList: for f in primeList: if numList[e] % primeList[f] != 0: #list index out of range for lops in Python do not generate indexes they return the actual ent