Re: [Tutor] Is input a Python function or command?

2005-07-31 Thread Alan G
> Is input a Python function or command? Its a function. You can tell because you need to use parens. print, by contrast, is a command and doesn't need parens... > I need to know because I'm planning to use it as > a variable, and don't want to get an error. Even if you don't want to use inpu

Re: [Tutor] cant get started

2005-07-31 Thread Alan G
I'm cc'ing this back to the tutor list because others may spot things I miss. >K something must be wrong cause I typed python and it said "python is >not > defined" so any ideas That means one of two things. Eother python is not installed yet, or you have installed it but the path to Python is

Re: [Tutor] single executable

2005-07-31 Thread Luis N
On 7/31/05, Jorge Louis de Castro <[EMAIL PROTECTED]> wrote: Hi,Thanks for your reply. I have been googling this issue and found thisarticle:http://starship.python.net/crew/theller/moin.cgi/SingleFileExecutable that seems to indicate what I want is possible and it is available. Hi, I looked at th

Re: [Tutor] single executable

2005-07-31 Thread Jorge Louis de Castro
Hi, Thanks for your reply. I have been googling this issue and found this article: http://starship.python.net/crew/theller/moin.cgi/SingleFileExecutable that seems to indicate what I want is possible and it is available. I downloaded NSIS and compiled (did not choose the option to create an i

Re: [Tutor] Is input a Python function or command?

2005-07-31 Thread Nathan Pinno
Thanks Luke. Saved me quite a headache. I will use in_file instead. Makes more sense anyway. - Original Message - From: "luke p" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]> Sent: Sunday, July 31, 2005 7:59 PM Subject: Re: [Tutor] Is input a Python function or command? why

[Tutor] Is input a Python function or command?

2005-07-31 Thread Nathan Pinno
Is input a Python function or command? I need to know because I'm planning to use it as a variable, and don't want to get an error.   Thanks, Nathan ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] What's the invaild syntax? Error message and relative codesupplied.

2005-07-31 Thread Nathan Pinno
Hey, looks like this is my problem. ) I'll just have to be more careful in the future. - Original Message - From: "Alan G" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]>; Sent: Sunday, July 31, 2005 6:24 PM Subject: Re: [Tutor] What's the invaild syntax? Error message and rel

Re: [Tutor] What's the invaild syntax? Error message and relative codesupplied.

2005-07-31 Thread Alan G
> What the invalid syntax? Here is the error message: > File "D:/Python22/grades.py", line 66 >which = which-1 > ^ >SyntaxError: invalid syntax OK, so it tells you the syntax is wrong and the line it detected the error. Try looking at a line or two before it. >while which

Re: [Tutor] Help with file I/O.

2005-07-31 Thread Alan G
>> You might find the getpass module useful for that... >> It provides a raw_input style prompt that doesn't >> display what the user types... > Does it display stars instead? No, its more secure than that, it doesn't display anything. But like anything in Python the esiest way to find out is j

Re: [Tutor] Help with file I/O.

2005-07-31 Thread Nathan Pinno
Does it display stars instead? - Original Message - From: "Alan G" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]>; "Alberto Troiano" <[EMAIL PROTECTED]>; "Danny Yoo" <[EMAIL PROTECTED]>; "luke" <[EMAIL PROTECTED]> Cc: Sent: Sunday, July 31, 2005 5:45 PM Subject: Re: [Tutor]

Re: [Tutor] What's the invaild syntax? Error message and relative codesupplied.

2005-07-31 Thread Nathan Pinno
Thanks again Luke. - Original Message - From: "luke" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]>; Sent: Sunday, July 31, 2005 5:50 PM Subject: Re: [Tutor] What's the invaild syntax? Error message and relative codesupplied. > NATHAN! > you have had this exact same problem

Re: [Tutor] What's the invaild syntax? Error message and relativecode supplied.

2005-07-31 Thread Nathan Pinno
Thanks Todd. Another one saved by you. - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Sunday, July 31, 2005 5:56 PM Subject: Re: [Tutor] What's the invaild syntax? Error message and relativecode supplied. > > Remember this problem from yesterday? > > Take a look at the line b

Re: [Tutor] single executable

2005-07-31 Thread jfouhy
Quoting Jorge Louis De Castro <[EMAIL PROTECTED]>: > Hi all, > I wrote a few small applications, couple hundred of lines each and one > of them playing around with tkinter. Now py2exe leaves 10 or so files of > all sorts and one executable to "distribute", and cx freeze isn't much > better. Furth

Re: [Tutor] What's the invaild syntax? Error message and relative code supplied.

2005-07-31 Thread python-tutor
Remember this problem from yesterday? Take a look at the line before the one you are getting the error on. And count the ('s and the )'s. --Todd On Sunday 31 July 2005 07:38 pm, Nathan Pinno wrote: > What the invalid syntax? Here is the error message: > SyntaxError: invalid syntax > File "D

Re: [Tutor] What's the invaild syntax? Error message and relative codesupplied.

2005-07-31 Thread luke
NATHAN! you have had this exact same problem yesterday! cmon man. If you see an invalid syntax error, look on the preceeding line. it's usually caused by not enough parenthesis for your function call. so we scroll down to lines 64-66... >which = 1234 >while which != -1: >

[Tutor] single executable

2005-07-31 Thread Jorge Louis De Castro
Hi all, I wrote a few small applications, couple hundred of lines each and one of them playing around with tkinter. Now py2exe leaves 10 or so files of all sorts and one executable to "distribute", and cx freeze isn't much better. Furthermore, my 15KB code becomes a whopping 8Meg distributa

[Tutor] single executable

2005-07-31 Thread Jorge Louis De Castro
Hi all, I wrote a few small applications, couple hundred of lines each and one of them playing around with tkinter. Now py2exe leaves 10 or so files of all sorts and one executable to "distribute", and cx freeze isn't much better. Furthermore, my 15KB code becomes a whopping 8Meg distributa

Re: [Tutor] Help with file I/O.

2005-07-31 Thread Alan G
> baffling me. Now I'm first going to write the main part of a > password You might find the getpass module useful for that... It provides a raw_input style prompt that doesn't display what the user types... HTH, Alan G. ___ Tutor maillist - Tutor@

[Tutor] single executable

2005-07-31 Thread Jorge Louis De Castro
Hi all, I wrote a few small applications, couple hundred of lines each and one of them playing around with tkinter. Now py2exe leaves 10 or so files of all sorts and one executable to "distribute", and cx freeze isn't much better. Isn't it possible to create a single, bundled windows execut

[Tutor] What's the invaild syntax? Error message and relative code supplied.

2005-07-31 Thread Nathan Pinno
What the invalid syntax? Here is the error message: SyntaxError: invalid syntax  File "D:/Python22/grades.py", line 66    which = which-1    ^SyntaxError: invalid syntax   Here is the code:   max_points = [25,25,50,25,100]assignments = ['hw ch 1','hw ch 2','quiz   ','hw ch 3','test']stud

Re: [Tutor] Thanks to all!

2005-07-31 Thread Nathan Pinno
I am going to try and tackle the file I/O exercise in Non-Programmers Tutorial For Python found at http://www.honors.montana.edu/~jjc/easytyt/easytut/easytut.html. Should be a fun task. - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Sunday, July 31, 2005 4:32 PM Subject: Re:

Re: [Tutor] Help with file I/O.

2005-07-31 Thread Nathan Pinno
I fixed it. Here is the latest code: filename = raw_input("File name please: ") f = file(filename, "r") for line in f.readlines(): print line f.close() Thanks for taking the time to explain the writing part, that was really baffling me. Now I'm first going to write the main part of a password

Re: [Tutor] Thanks to all!

2005-07-31 Thread python-tutor
Congratulations! So what are you going to try next? --Todd On Sunday 31 July 2005 06:27 pm, Nathan Pinno wrote: > The Giant Calculator is perfect also! > - Original Message - > From: Nathan Pinno > To: tutor@python.org > Sent: Sunday, July 31, 2005 3:34 PM > Subject: [Tutor] T

Re: [Tutor] Thanks to all!

2005-07-31 Thread Nathan Pinno
The Giant Calculator is perfect also! - Original Message - From: Nathan Pinno To: tutor@python.org Sent: Sunday, July 31, 2005 3:34 PM Subject: [Tutor] Thanks to all! Thank you to all. All my calculators run perfect. I can now make a perfect Giant Calculator a

Re: [Tutor] Help with file I/O.

2005-07-31 Thread Alan G
> file = raw_input("File name please: ") > f = file(file, "r") The problem is you used 'file' as a name. But file() is the function to open a file. So in the second line you call your filename as if it was a function! Try using 'filename' for your variable instead. It's never a good idea to us

Re: [Tutor] substitute function

2005-07-31 Thread Alan G
>> Is there a 'substitute' function in python. > You can do this with the translate() method of a string. That was the clever stuff I was trying to remember, not a module after all, a method! Thanks Kent, Alan G. ___ Tutor maillist - Tutor@python.

Re: [Tutor] substitute function

2005-07-31 Thread Alan G
> Is there a 'substitute' function in python. Assuming we are dealing with strings then there are two. The string objects provide a replace() method and the regulatr expression module re provides substitute. > I want to substitute A with T and G with C and vice > versa > > A -> T > G -> C > T -

Re: [Tutor] Help with file I/O.

2005-07-31 Thread luke
Nathan, I saw in your previous example that you called #quote file = raw_input("File name please: ") f = file(file, "r") for line in f.readlines(): print line f.close() #endquote the reason you were getting an error is that you made a variable named "file" on line one, which then overwrote th

[Tutor] Thanks to all!

2005-07-31 Thread Nathan Pinno
Thank you to all. All my calculators run perfect. I can now make a perfect Giant Calculator as well.   Thanks again, Nathan ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help with file I/O.

2005-07-31 Thread Nathan Pinno
Okay I understand how to open and read to a file, but how do I write to a file, e.g. a list. - Original Message - From: "Nathan Pinno" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]>; "Danny Yoo" <[EMAIL PROTECTED]> Cc: Sent: Sunday, July 31, 2005 2:46 PM Subject: Re: [Tutor]

Re: [Tutor] Help with file I/O.

2005-07-31 Thread Nathan Pinno
Here's the improved version. file = raw_input("File name please: ") f = open(file) for line in f.readlines(): print line f.close() - Original Message - From: "Nathan Pinno" <[EMAIL PROTECTED]> To: "Danny Yoo" <[EMAIL PROTECTED]> Cc: Sent: Sunday, July 31, 2005 2:29 PM Subject: Re: [T

Re: [Tutor] Help with file I/O.

2005-07-31 Thread Nathan Pinno
Just ran the code and got the following error: File name please: news.text Traceback (most recent call last): File "D:\Python22\filewriter.py", line 2, in ? f = file(file, "r") TypeError: 'str' object is not callable Why isn't it callable? Help me understand. - Original Message - Fr

Re: [Tutor] Help with file I/O.

2005-07-31 Thread Nathan Pinno
Here's my work. I call it filewriter. The code: file = raw_input("File name please: ") f = file(file, "r") for line in f.readlines(): print line f.close() Will it do the trick? Nathan - Original Message - From: "Danny Yoo" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]> Cc

Re: [Tutor] substitute function

2005-07-31 Thread Srinivas Iyyer
yes luke. I could you biopython, but i am giving a shot to bypass it and write my own. thank you kent for your reply. srini --- luke <[EMAIL PROTECTED]> wrote: > Are you making a biology program Srinivas? > > - Original Message - > From: "Kent Johnson" <[EMAIL PROTECTED]> > Cc: > Sen

Re: [Tutor] substitute function

2005-07-31 Thread luke
Are you making a biology program Srinivas? - Original Message - From: "Kent Johnson" <[EMAIL PROTECTED]> Cc: Sent: Sunday, July 31, 2005 2:46 PM Subject: Re: [Tutor] substitute function > Srinivas Iyyer wrote: > > Hello group: > > > > Is there a 'substitute' function in python. > > > >

Re: [Tutor] substitute function

2005-07-31 Thread Kent Johnson
Srinivas Iyyer wrote: > Hello group: > > Is there a 'substitute' function in python. > > For example: > I want to substitute A with T and G with C and vice > versa > > A -> T > G -> C > T -> A > c -> G You can do this with the translate() method of a string. It is a two-step process. First you

Re: [Tutor] How do I make a Python program keep repeating?

2005-07-31 Thread Nathan Pinno
I'd post another code, but I've already figured it out, thanks to help on the mini calc program. - Original Message - From: "Alan G" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]>; Sent: Sunday, July 31, 2005 2:03 AM Subject: Re: [Tutor] How do I make a Python program keep re

[Tutor] substitute function

2005-07-31 Thread Srinivas Iyyer
Hello group: Is there a 'substitute' function in python. For example: I want to substitute A with T and G with C and vice versa A -> T G -> C T -> A c -> G thanks Start your day with Yahoo! - make it your home page http://

[Tutor] file IO tutorial

2005-07-31 Thread Rob Andrews
http://uselesspython.com/tutorials/PythonFileIOStepByStep.pdf I've written a quick step-by-step .pdf to walk through the process of creating a new text file, read from it, and append to it with Python. It doesn't cover every last thing one can do with opened files, but does point to a few other re

Re: [Tutor] mysterious Python error

2005-07-31 Thread Kent Johnson
Tom Cloyd wrote: > I'm working on a WinXP SP-2 OS. > > I'm too ill-informed to figure this out: When I execute > > C:\Python24\python.exe > > I get > > 'import site' failed.; use -v for traceback > ActivePython 2.4.1 Build 247 ... > > > I then ran this from a DOS window, and tried to redirect

Re: [Tutor] learning classes (kinda long)

2005-07-31 Thread Kent Johnson
Reed L. O'Brien wrote: > This is a little long > a program consisting of > bsserver.py ## to define server class and methods > bscaller.py ## to define a test class subclasses for services (imap > http pop dns et al) > bslogger.py ## to log and analyze tests and send emails on > exceptions/fail

Re: [Tutor] Socket Programming

2005-07-31 Thread Kent Johnson
Joseph Quigley wrote: > I have no idea how to get the server to receive and print a message or > for the client to send the message. Does anyone know of some good python > networking tutorials designed for newbies? (Not ones on > www.awaretek.com. They seem to expect you to know some things that

Re: [Tutor] JBUS and Python which way

2005-07-31 Thread Alan G
Miguel, I've never heard of JBUS but if its an RS232 protocol then it is possible to get Python to talk to RS232 posts using various 'serial' comms modules. Its not the easiest thing in the world but itss definitely possible. HTH, Alan G. - Original Message - From: "Miguel Lopes" <[

Re: [Tutor] learning classes (kinda long)

2005-07-31 Thread Alan G
> first I would like for this instance to be named the name of the > host in > the section but i keep getting instances named section This is a common beginners question but its nearly always the wrong thing to do. For a start how would the rest of your program know about these new instance names

Re: [Tutor] cant get started

2005-07-31 Thread Alan G
> it said this is for newbies but I download the 2.4 and I tried the > stuff it > said on the tutorial like the control-z or sys.exit () I tried the > control-p > or the python -c but it always says "'something' is not defined" or > " invalid > syntax" where do I go or what do I do. do i go th

Re: [Tutor] Help with file I/O.

2005-07-31 Thread Alan G
> If anyone will help me learn file I/O, it would be appreciated. > I went through Josh Cogliani's Non-Programmer's Tutorial for Python, > and I still can't understand it. What exactly don't you understand? Try the file handling topic in my tutor. see if thats any clearer? It covers opening, read

Re: [Tutor] Now what do I do?(was Re: When I run this code, it just keeps repeating.)

2005-07-31 Thread Alan G
> while cal_opt != 9: >menu() >cal_opt = cal() >if cal_opt == 1: >elif cal_opt == 2: ... >elif cal_opt == 7: >else: >print "That's not an option. Try again." >menu() >cal() Because you don't have a specific check for the exit value (9) the else part

Re: [Tutor] How do I make a Python program keep repeating?

2005-07-31 Thread Alan G
> How do I make a program keep repeating until the user is done with > it? The math shapes example you just sent in with a syntax area does just that. What else do you need? Alan g ___ Tutor maillist - Tutor@python.org http://mail.python.org/mail

Re: [Tutor] What's the invalid synax? Error message and code supplied.

2005-07-31 Thread Alan G
> option = int(raw_input('Option (1,2,3,4,5,6,9): ') Count the parentheses, there's one missing! Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] mysterious Python error

2005-07-31 Thread Alan G
HI Tom, This message answers a couple of questions but not the one you really need - whats going wrong?! > I then ran this from a DOS window, and tried to redirect the -v > output to a text file, so I could include it, but nothing I did was > successful. I can't imagine why the output wouldn'