[Tutor] NLTK

2009-01-14 Thread Ishan Puri
Hi, I have download NLTK for Python 2.5. It download automatically to C:\Program Files\Python25\libs\site-packages\nltk. When I try to open a module in python, it says that no such module exists. What do I need to do?___ Tutor maillist - Tutor@pyt

Re: [Tutor] strings and int()

2009-01-14 Thread wesley chun
> If you have a string "6", and you do int("6"), you get the number 6. > But if you have a string "2*3" and you do int("2*3") you get a name error. the reason you get this error is because "2*3" is not a string representation of an integer whereas "6" is. in other words 2*3 is not a number. > Ho

[Tutor] Creating simple windows in XP

2009-01-14 Thread Alex Krycek
Hello, I'd like to create very simple GUI's in XP. For the sake of simplicity, I'm trying to avoid downloading and installing anything (although I am considering EasyGui). To see how well it works, I've tried having my program run a Visual Basic script ( i.e. subprocess.call(someScript.vbs, shel

[Tutor] Non-blocking non-interactive graphics display

2009-01-14 Thread David Williams
Hi All, I am still getting my python legs (similar to sea legs but more scale-y) and ran across a decision that I'd like some advice on. I am looking for the simplest way of displaying a little positional data as a line graphic in a window as a script runs. Something like: #Set up some

[Tutor] tkinter canvas

2009-01-14 Thread Mr Gerard Kelly
I am trying to make a simple Tkinter program using the canvas widget. All it does take a number (6 in this case) and draw that number of blue boxes on a canvas. from Tkinter import * master = Tk() numboxes=6 width=40*(numboxes+2) height=200 w = Canvas(master, width=width, height=height) w.pack(

Re: [Tutor] eval and floating point

2009-01-14 Thread Bill Campbell
On Wed, Jan 14, 2009, jadrifter wrote: >On Thu, 2009-01-15 at 12:19 +1000, Mr Gerard Kelly wrote: >> Thanks very much >> >> I've noticed that the eval() function gives an integer, so eval("3/2") >> gives back 1. float(eval("3/2")) doesn't seem to work, any way to get a >> floating point number bac

Re: [Tutor] eval and floating point

2009-01-14 Thread jadrifter
On Thu, 2009-01-15 at 12:19 +1000, Mr Gerard Kelly wrote: > Thanks very much > > I've noticed that the eval() function gives an integer, so eval("3/2") > gives back 1. float(eval("3/2")) doesn't seem to work, any way to get a > floating point number back with eval()? > > I know you can just do ("

Re: [Tutor] eval and floating point

2009-01-14 Thread Vern Ceder
Mr Gerard Kelly wrote: Thanks very much I've noticed that the eval() function gives an integer, so eval("3/2") gives back 1. float(eval("3/2")) doesn't seem to work, any way to get a floating point number back with eval()? I know you can just do ("3./2."), but is there any way to do it with jus

Re: [Tutor] eval and floating point

2009-01-14 Thread Jervis Whitley
On Thu, Jan 15, 2009 at 1:19 PM, Mr Gerard Kelly wrote: > Thanks very much > > I've noticed that the eval() function gives an integer, so eval("3/2") > gives back 1. float(eval("3/2")) doesn't seem to work, any way to get a > floating point number back with eval()? > > I know you can just do ("3.

Re: [Tutor] running & debugging in python interactive shell

2009-01-14 Thread Che M
> Date: Wed, 14 Jan 2009 16:44:11 -0800 > From: artie.z...@gmail.com > To: tutor@python.org > Subject: [Tutor] running & debugging in python interactive shell > > Greetings. > > I am attempting to search archives, however I thought it would be OK to > ask while I search... thank you to those w

[Tutor] eval and floating point

2009-01-14 Thread Mr Gerard Kelly
Thanks very much I've noticed that the eval() function gives an integer, so eval("3/2") gives back 1. float(eval("3/2")) doesn't seem to work, any way to get a floating point number back with eval()? I know you can just do ("3./2."), but is there any way to do it with just ("3/2")? __

[Tutor] running & debugging in python interactive shell

2009-01-14 Thread Artie Ziff
Greetings. I am attempting to search archives, however I thought it would be OK to ask while I search... thank you to those who responded to my previous inquiry. Your response was very helpful to me. My environment is embedded so I have only a python interactive shell for running python scripts.

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-14 Thread Alan Gauld
"Marc Tompkins" wrote - Also as wesley said, there MAY BE two separate PATHs - in my experience, the user-level one is usually empty and can be deleted to avoid confusion. If it's _not_ empty, it's usually by mistake... It should be used where multiple users use a single machine and they

Re: [Tutor] strings and int()

2009-01-14 Thread jadrifter
Try eval("2*3") On Thu, 2009-01-15 at 10:14 +1000, Mr Gerard Kelly wrote: > If you have a string "6", and you do int("6"), you get the number 6. > > But if you have a string "2*3" and you do int("2*3") you get a name error. > > How do you take an expression in a string, and evaluate the expressi

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-14 Thread Alan Gauld
"Brian van den Broek" wrote icon for Idle launching as expected. When run from IDLE, `print sys.executable' yields `C:\\Python26\\pythonw.exe'. He reports that C:\Python26 contains both python.exe and pythonw.exe. I've had him add the text `;C:\Python26' (without quotes) to the end of his

Re: [Tutor] lists and Entry

2009-01-14 Thread Alan Gauld
"Mr Gerard Kelly" wrote There is a little Tkinter program. It lets you type something in a box, and will display it at the command line. e = Entry(master) e.pack() def callback(): s=e.get() print s b = Button(master, text="get", width=10, command=callback) The get() method returns a

[Tutor] strings and int()

2009-01-14 Thread Mr Gerard Kelly
If you have a string "6", and you do int("6"), you get the number 6. But if you have a string "2*3" and you do int("2*3") you get a name error. How do you take an expression in a string, and evaluate the expression to get a number? I want to be able to turn the string "2*3" into the number 6. t

Re: [Tutor] Python3.0 and Tkinter on ubuntu 8.10 HOWTO

2009-01-14 Thread Emad Nawfal (عماد نوفل)
Great source for Unicode lovers On Wed, Jan 14, 2009 at 3:53 PM, Robert Berman wrote: > Very good and most welcome. > > Robert Berman > > Vern Ceder wrote: > >> Since there was some interest in the question of how to get a full Python >> 3.0, including Tkinter and IDLE, compiled on Ubuntu Intrep

Re: [Tutor] quoting and escaping

2009-01-14 Thread Jon Crump
Kent, Steve, Marty, et alia, On Tue, 13 Jan 2009, Kent Johnson wrote: Where does this come from? It looks like the string representation of a dict. Can you get the actual dict? Perhaps there is a better way to do whatever you are doing? It does look like that doesn't it, but it's actually a j

Re: [Tutor] help with getting python to run from command prompt on Windows XP

2009-01-14 Thread Marc Tompkins
On Wed, Jan 14, 2009 at 12:09 PM, wesley chun wrote: > > i fully agree with kent's comments/suggestions. you appeared to have > them do the right thing. fwiw, the only time i run into that error > after doing the same thing as you is that i'm trying that command in > an already-opened command win

Re: [Tutor] Python3.0 and Tkinter on ubuntu 8.10 HOWTO

2009-01-14 Thread Robert Berman
Very good and most welcome. Robert Berman Vern Ceder wrote: Since there was some interest in the question of how to get a full Python 3.0, including Tkinter and IDLE, compiled on Ubuntu Intrepid 8.10, I've written up what I've done and posted it at http://learnpython.wordpress.com/2009/01/14/

[Tutor] Python3.0 and Tkinter on ubuntu 8.10 HOWTO

2009-01-14 Thread Vern Ceder
Since there was some interest in the question of how to get a full Python 3.0, including Tkinter and IDLE, compiled on Ubuntu Intrepid 8.10, I've written up what I've done and posted it at http://learnpython.wordpress.com/2009/01/14/installing-python-30-on-ubuntu/ Cheers, Vern Ceder -- This t

Re: [Tutor] traceback

2009-01-14 Thread Willi Richert
Hi, do you observe the same behavior with traceback.format_exc()? I've used that always in such situations which worked all the time. Regards, wr Am Mittwoch, 14. Januar 2009 18:09:51 schrieb spir: > Hello, > > I rather often use exceptions as information providers at design or debug > time. A

Re: [Tutor] help with getting python to run from command prompt on Windows XP

2009-01-14 Thread wesley chun
On Wed, Jan 14, 2009 at 12:01 PM, Kent Johnson wrote: > On Wed, Jan 14, 2009 at 2:36 PM, Brian van den Broek > wrote: >> >> He's got python 2.6.1 installed as evidenced by the Startbar program >> icon for Idle launching as expected. When run from IDLE, `print >> sys.executable' yields `C:\\Python

Re: [Tutor] help with getting python to run from command prompt on Windows XP

2009-01-14 Thread Kent Johnson
On Wed, Jan 14, 2009 at 2:36 PM, Brian van den Broek wrote: > Hi all, > > I'm trying, via email, to help a friend set up python on his Windows > XP computer. I've been strictly linux for some time now, and don't > have a Windows machine on which to investigate. We've hit a problem, > and I'd appre

[Tutor] help with getting python to run from command prompt on Windows XP

2009-01-14 Thread Brian van den Broek
Hi all, I'm trying, via email, to help a friend set up python on his Windows XP computer. I've been strictly linux for some time now, and don't have a Windows machine on which to investigate. We've hit a problem, and I'd appreciate a push. He's got python 2.6.1 installed as evidenced by the Star

[Tutor] help with getting python to run from command prompt on Windows XP

2009-01-14 Thread Brian van den Broek
Hi all, I'm trying, via email, to help a friend set up python on his Windows XP computer. I've been strictly linux for some time now, and don't have a Windows machine on which to investigate. We've hit a problem, and I'd appreciate a push. He's got python 2.6.1 installed as evidenced by the

Re: [Tutor] Small python web server suitable for web cam streams?

2009-01-14 Thread Kent Johnson
On Wed, Jan 14, 2009 at 12:53 PM, Wesley Brooks wrote: > The very best would have time plots for various temperatures (these of > course could be images generated by seperate scripts as before) and email > alerts out to users when a job is complete or an error occurs. I've used matplotlib to dyna

Re: [Tutor] Sys.stdin Question

2009-01-14 Thread Damon Timm
On Tue, Jan 13, 2009 at 9:05 PM, John Fouhy wrote: > It's easy to test: > > ### test.py ### > import time > time.sleep(1) > print 'foo' > ### > > $ python test.py | python stdintest.py > Nothing to see here. > close failed: [Errno 32] Broken pipe > > [not shown: the 1 second pause after "Nothing

Re: [Tutor] Small python web server suitable for web cam streams?

2009-01-14 Thread Wesley Brooks
At the minimum the page would need to display progress through a job, any error messages, and a picture from the web camera. I've used something that grabbed images from a USB camera using python a while back so at the simplest I could be just after something to display a html page with an image an

Re: [Tutor] traceback

2009-01-14 Thread Kent Johnson
On Wed, Jan 14, 2009 at 12:09 PM, spir wrote: > Hello, > > I rather often use exceptions as information providers at design or debug > time. A typical use > of mine is to have a test version of methods that wrap standard version: > > def run(): >do stuff >that may >raise e

Re: [Tutor] Selecting first matching element from a list

2009-01-14 Thread Kent Johnson
On Wed, Jan 14, 2009 at 11:25 AM, bob gailer wrote: > How many ways are there in Python to go thru a list (and apply a function to > each element)? The ones I know are: > while > for > list comprehension > map() filter() is more appropriate than map() for this problem generator expression itertoo

[Tutor] traceback

2009-01-14 Thread spir
Hello, I rather often use exceptions as information providers at design or debug time. A typical use of mine is to have a test version of methods that wrap standard version: def run(): do stuff that may raise exc def testRun(): try: run() e

Re: [Tutor] Selecting first matching element from a list

2009-01-14 Thread bob gailer
Noufal Ibrahim wrote: bob gailer wrote: 2) "looks bad" and "is ugly" are emotional responses. What are you feeling and wanting when you say those things? It's hard for me to qualify really but my general idea of list comprehensions is that they transform and filter lists creating other li

Re: [Tutor] Small python web server suitable for web cam streams?

2009-01-14 Thread Kent Johnson
On Wed, Jan 14, 2009 at 10:37 AM, Wesley Brooks wrote: > I have a machine which runs for extended periods of time, and often into > days rather than just hours. I would like to set up the computer so that it > hosts a simple web page displaying current status information, and a feed > from a web c

[Tutor] Small python web server suitable for web cam streams?

2009-01-14 Thread Wesley Brooks
Dear Users, I'm aware that there is a large array of web toolkits available in python and I would like to hear some opinions on which may be best suited to my specification so I can research them further. I have a machine which runs for extended periods of time, and often into days rather than ju

Re: [Tutor] lists and Entry

2009-01-14 Thread Emad Nawfal (عماد نوفل)
On Wed, Jan 14, 2009 at 5:52 AM, Mr Gerard Kelly wrote: > There is a little Tkinter program. It lets you type something in a box, > and will display it at the command line. > > > from Tkinter import * > > master = Tk() > > e = Entry(master) > e.pack() > > e.focus_set() > > def callback(): > s=e.

Re: [Tutor] lists and Entry

2009-01-14 Thread Andre Engels
On Wed, Jan 14, 2009 at 11:52 AM, Mr Gerard Kelly wrote: > There is a little Tkinter program. It lets you type something in a box, > and will display it at the command line. > > > from Tkinter import * > > master = Tk() > > e = Entry(master) > e.pack() > > e.focus_set() > > def callback(): > s=e.

Re: [Tutor] Active State Python with IDLE Python 2.5

2009-01-14 Thread Richard Lovely
The Activestate package IS vanilla python. It just comes packaged with a few addon modules for things such as ActiveX and with windows GUI libraries. If it works with Vanilla Python, there's virtually no reason it won't work with the activestate distribution, and vice versa, as long as you don't

[Tutor] lists and Entry

2009-01-14 Thread Mr Gerard Kelly
There is a little Tkinter program. It lets you type something in a box, and will display it at the command line. from Tkinter import * master = Tk() e = Entry(master) e.pack() e.focus_set() def callback(): s=e.get() print s b = Button(master, text="get", width=10, command=callback) b.pac

Re: [Tutor] Selecting first matching element from a list

2009-01-14 Thread Noufal Ibrahim
bob gailer wrote: 2) "looks bad" and "is ugly" are emotional responses. What are you feeling and wanting when you say those things? It's hard for me to qualify really but my general idea of list comprehensions is that they transform and filter lists creating other lists. For instance, I'd