Re: [Tutor] ask

2010-02-19 Thread Andre Engels
On Sat, Feb 20, 2010 at 8:07 AM, Shurui Liu (Aaron Liu) wrote: > How to describe a math formula: sphere=(4/3)*PI*R**3? A function seems like the logical thing to do: import math def spherical_volume(radius): return (4.0/3)*math.pi*radius**3 -- André Engels, andreeng...@gmail.com _

[Tutor] ask

2010-02-19 Thread Shurui Liu (Aaron Liu)
How to describe a math formula: sphere=(4/3)*PI*R**3? -- Shurui Liu (Aaron Liu) Computer Science & Engineering Technology University of Toledo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/

Re: [Tutor] The Disappearing Program (py2exe)

2010-02-19 Thread Wayne Watson
OK, I'm completely on Win7. hello.exe works as expected by the tutorial. That file is in dist. I've now tried this program, pylab_scatter.py: #!/usr/bin/env python from pylab import * N = 30 x = 0.9*rand(N) y = 0.9*rand(N) area = pi*(10 * rand(N))**2 # 0 to 10 point radiuses scatter(x,y,s=a

Re: [Tutor] Is it possible for a Python Program to send commands to the Python Interpreter?

2010-02-19 Thread Kent Johnson
On Fri, Feb 19, 2010 at 7:07 PM, Steven D'Aprano wrote: > On Sat, 20 Feb 2010 06:33:04 am Kent Johnson wrote: > >> It sounds like you are looking for eval() >> >> (Standard warning - use eval() only on trusted data) > > > This is the tutor list, aimed at beginners to Python, many of whom are > als

Re: [Tutor] Is it possible for a Python Program to send commands to the Python Interpreter?

2010-02-19 Thread ALAN GAULD
Looks like the eval() will work great. Thanks so much for telling me. > >We normally warn against using eval/exec because they form a security risk. But in your case you are in control of the code that they execute so its ok. That is the kind of usage where they are the best solution. Be ve

Re: [Tutor] Is it possible for a Python Program to send commands to the Python Interpreter?

2010-02-19 Thread Steven D'Aprano
On Sat, 20 Feb 2010 06:33:04 am Kent Johnson wrote: > It sounds like you are looking for eval() > > (Standard warning - use eval() only on trusted data) This is the tutor list, aimed at beginners to Python, many of whom are also beginners to programming as well. Even experienced programmers of

Re: [Tutor] Reading large bz2 Files

2010-02-19 Thread Norman Rieß
Am 19.02.2010 22:24, schrieb Lie Ryan: > On 02/20/10 07:49, Norman Rieß wrote: > >> Am 19.02.2010 21:42, schrieb Lie Ryan: >> >>> On 02/19/10 23:42, Norman Rieß wrote: >>> >>> Hello, i am trying to read a large bz2 file with this code: source_file = bz2.BZ

Re: [Tutor] The Disappearing Program (py2exe)

2010-02-19 Thread Wayne Watson
XP. Win 7, I hope, by the end of the day. Stuff is working under Win 7 from my transfer of it from a week or so ago. The only thing I left on XP was the py2exe stuff. I'm writing this from my Win 7 machine. There's a big twist in this. I've verified that when I typed the name w/o py, it really

Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5

2010-02-19 Thread Wayne Watson
Things were not quite what the seem. I just tried to run a program that was not converted, and left off py. It worked. So maybe the only way to execute the compiled code is to to to dist? -- "There is nothing so annoying as to have two people talking when you're busy

Re: [Tutor] Reading large bz2 Files

2010-02-19 Thread Norman Rieß
Am 19.02.2010 22:03, schrieb Kent Johnson: > On Fri, Feb 19, 2010 at 7:42 AM, Norman Rieß wrote: > >> Hello, >> >> i am trying to read a large bz2 file with this code: >> >> source_file = bz2.BZ2File(file, "r") >> for line in source_file: >>print line.strip() >> >> But after 4311 lines, it

Re: [Tutor] Is it possible for a Python Program to send commands to the Python Interpreter?

2010-02-19 Thread Carnell, James E
Thanks Kent and Alan!! Problem solved, eval() will work great! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5

2010-02-19 Thread Wayne Watson
I suppose I'm in an interesting situation with regard to Win cmd prompt. I did this work on XP. There the facility is a bit more constraining than Win7 on my new PC. On XP, I do not have name completion w/o setting something. I only recently started with cmd prompt again. In Win7, it's automa

Re: [Tutor] Reading large bz2 Files

2010-02-19 Thread Lie Ryan
On 02/20/10 07:49, Norman Rieß wrote: > Am 19.02.2010 21:42, schrieb Lie Ryan: >> On 02/19/10 23:42, Norman Rieß wrote: >> >>> Hello, >>> >>> i am trying to read a large bz2 file with this code: >>> >>> source_file = bz2.BZ2File(file, "r") >>> for line in source_file: >>> print line.strip()

Re: [Tutor] Reading large bz2 Files

2010-02-19 Thread Lie Ryan
On 02/20/10 07:42, Lie Ryan wrote: > On 02/19/10 23:42, Norman Rieß wrote: >> Hello, >> >> i am trying to read a large bz2 file with this code: >> >> source_file = bz2.BZ2File(file, "r") >> for line in source_file: >> print line.strip() >> >> But after 4311 lines, it stoppes without a errormess

Re: [Tutor] Reading large bz2 Files

2010-02-19 Thread Kent Johnson
On Fri, Feb 19, 2010 at 7:42 AM, Norman Rieß wrote: > Hello, > > i am trying to read a large bz2 file with this code: > > source_file = bz2.BZ2File(file, "r") > for line in source_file: >    print line.strip() > > But after 4311 lines, it stoppes without a errormessage. The bz2 file is > much bigg

Re: [Tutor] Reading large bz2 Files

2010-02-19 Thread Norman Rieß
Am 19.02.2010 21:42, schrieb Lie Ryan: > On 02/19/10 23:42, Norman Rieß wrote: > >> Hello, >> >> i am trying to read a large bz2 file with this code: >> >> source_file = bz2.BZ2File(file, "r") >> for line in source_file: >> print line.strip() >> >> But after 4311 lines, it stoppes without a

Re: [Tutor] Reading large bz2 Files

2010-02-19 Thread Lie Ryan
On 02/19/10 23:42, Norman Rieß wrote: > Hello, > > i am trying to read a large bz2 file with this code: > > source_file = bz2.BZ2File(file, "r") > for line in source_file: > print line.strip() > > But after 4311 lines, it stoppes without a errormessage. The bz2 file is > much bigger though.

Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5

2010-02-19 Thread Alan Gauld
"Wayne Watson" wrote pylab_scatter.exe. Interestingly, if I fire it up from the Win folder, a dos-window appears and it dies. A few lines appear too quickly to read. If I execute it from the command prompt, it works fine. Still the mystery to me is why I don't need to add exe in the cmd prompt

Re: [Tutor] Is it possible for a Python Program to send commands to thePython Interpreter?

2010-02-19 Thread Alan Gauld
"Carnell, James E" wrote I am trying to teach a computer program - to program. It builds grammars and procedural memories on dictionary networks. How do I get the program to be able to input to the interpreter/command line and read the results? You probably don;t want to do that. I suspect

Re: [Tutor] Is it possible for a Python Program to send commands to the Python Interpreter?

2010-02-19 Thread Kent Johnson
On Fri, Feb 19, 2010 at 1:56 PM, Carnell, James E wrote: > > I am trying to teach a computer program - to program. It builds grammars and > procedural memories on dictionary networks. How do I get the program to be > able to input to the interpreter/command line and read the results? I have > done

[Tutor] Is it possible for a Python Program to send commands to the Python Interpreter?

2010-02-19 Thread Carnell, James E
I am trying to teach a computer program - to program. It builds grammars and procedural memories on dictionary networks. How do I get the program to be able to input to the interpreter/command line and read the results? I have done this a wee bit with making a dictionary of functions, but in a sen

Re: [Tutor] Reading large bz2 Files

2010-02-19 Thread Norman Rieß
Am 19.02.2010 17:04, schrieb Steven D'Aprano: > My guess is one of two things: > (1) You are mistaken that the file is bigger than 4311 lines. > > (2) You are using Windows, and somehow there is a Ctrl-Z (0x26) > character in the file, which Windows interprets as End Of File when > reading files

Re: [Tutor] The Disappearing Program (py2exe)

2010-02-19 Thread Robert Berman
Wayne, I am assuming you are using Win 7 and I'll answer with that unless you tell me you are using XP in which case I will walk over to my wife's desk and test what I am telling you on her XP driven machine. Assuming Windows 7. Looking at your directory you should be using Windows Explorer. Cli

Re: [Tutor] Python and algorithms

2010-02-19 Thread C.T. Matsumoto
spir wrote: On Thu, 18 Feb 2010 09:11:22 -0500 Kent Johnson wrote: It's true that solving a problem often involves creating an algorithm in a broad sense. The formal study of algorithms studies specific techniques and algorithms that have proven to be useful to solve many hard problems. In

Re: [Tutor] Reading large bz2 Files

2010-02-19 Thread Stefan Behnel
Norman Rieß, 19.02.2010 13:42: > i am trying to read a large bz2 file with this code: > > source_file = bz2.BZ2File(file, "r") > for line in source_file: > print line.strip() > > But after 4311 lines, it stoppes without a errormessage. What does "stops" mean here? Does it crash? Does it exit

Re: [Tutor] Reading large bz2 Files

2010-02-19 Thread Steven D'Aprano
On Fri, 19 Feb 2010 11:42:07 pm Norman Rieß wrote: > Hello, > > i am trying to read a large bz2 file with this code: > > source_file = bz2.BZ2File(file, "r") > for line in source_file: > print line.strip() > > But after 4311 lines, it stoppes without a errormessage. The bz2 file > is much bigg

Re: [Tutor] The Disappearing Program (py2exe)

2010-02-19 Thread Wayne Watson
The answer now appears in "Wrestling with ...". It's in a dist folder that py2exe produces. See Robert Berman post today, 2/19 early in morning. 5:34 am here. On 2/19/2010 7:00 AM, Wayne Watson wrote: I've successfully compiled several small python programs on Win XP into executables using py

Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5

2010-02-19 Thread Wayne Watson
Sneaky! :-) Yes, I now recall you mentioning it earlier. I'm looking at dist right now. I see a program I built in a folder above dist, pylab_scatter.exe. Interestingly, if I fire it up from the Win folder, a dos-window appears and it dies. A few lines appear too quickly to read. If I execute i

[Tutor] The Disappearing Program (py2exe)

2010-02-19 Thread Wayne Watson
I've successfully compiled several small python programs on Win XP into executables using py2exe. A program goes from a name like snowball.py to snowball. A dir in the command prompt window finds snowball.py but not snowball. If I type in snowball, it executes. What's up with that? --

Re: [Tutor] Wrestling with the Py2exe Install, Win7[XP!], Py2.5

2010-02-19 Thread Robert Berman
Wayne, Somewhere in the tutorial should be a comment about py2exe creating two additional directories: build and dist. Forget about the build directory. If you look in the dist directory you will find the exe file and all supporting files. If you look back to an earlier email you will see a more d

[Tutor] Reading large bz2 Files

2010-02-19 Thread Norman Rieß
Hello, i am trying to read a large bz2 file with this code: source_file = bz2.BZ2File(file, "r") for line in source_file: print line.strip() But after 4311 lines, it stoppes without a errormessage. The bz2 file is much bigger though. How can i read the whole file line by line? Thank you.

Re: [Tutor] Python and algorithms

2010-02-19 Thread spir
On Thu, 18 Feb 2010 09:11:22 -0500 Kent Johnson wrote: > It's true that solving a problem often involves creating an algorithm > in a broad sense. The formal study of algorithms studies specific > techniques and algorithms that have proven to be useful to solve many > hard problems. In my experie