Re: [Tutor] (no subject)

2010-08-26 Thread Volodymyr Buell
Hi Roelof, The problem is in quotation marks. Please use plain double instead of curly quotes. (That's a common issue when you copy-paste the code from pdf/doc) On Thu, Aug 26, 2010 at 9:25 AM, Roelof Wobben wrote: > Hello, > > I have this exercise : > > > Try each of the following formatted stri

Re: [Tutor] why does this fail

2010-08-26 Thread Alan Gauld
"Roelof Wobben" wrote then I have a problem. Im following this book : http://openbookproject.net/thinkcs/python/english2e/ which is the first link in the beginners tutorial page. And it's talking about the string modules. So it is which is quite bizarre since it is using Python 2.5! The

Re: [Tutor] Trouble with exercise regarding classes

2010-08-26 Thread Alan Gauld
"Andrew Martin" wrote I want to compare zenith, a floating point number, with the current y value? I thought the current y value could be retrieved by Projectile.getY. Projectile.getY is a reference to the getY method of the Projectile class. (See the separate thread on function objects f

[Tutor] wx to convert Group 4 Tifs to Gifs

2010-08-26 Thread Albert-Jan Roskam
Hi, I have a small application, written in Tkinter. It is supposed to display a tif image, among other things. The problem is, PIL won't decode group 4 Tifs (G4 TIF). The tifs that I have are about 125kb and contain two pages per file. They're scanned, monochrome files. I need the second page o

Re: [Tutor] wx to convert Group 4 Tifs to Gifs

2010-08-26 Thread Christian Witts
On 26/08/2010 11:46, Albert-Jan Roskam wrote: Hi, I have a small application, written in Tkinter. It is supposed to display a tif image, among other things. The problem is, PIL won't decode group 4 Tifs (G4 TIF). The tifs that I have are about 125kb and contain two pages per file. They're scan

Re: [Tutor] continuous running of a method

2010-08-26 Thread Steven D'Aprano
On Thu, 26 Aug 2010 12:27:03 pm R. Alan Monroe wrote: > > Any modern multi-tasking operating system will ensure than a while > > loop doesn't kill your computer's responsiveness. A decent > > operating system will still remain responsive even at 100% CPU > > usage. Even Windows does that! > > Opini

Re: [Tutor] design of Point class

2010-08-26 Thread Steven D'Aprano
On Thu, 26 Aug 2010 07:29:42 am Gregory, Matthew wrote: > I hope you'll suffer me one more question on this thread. In > thinking about creating other distance methods (as you suggest), how > best to create a generic enough interface, so that ANY distance > metric could be used. It seems like co

[Tutor] question about lists and doctest

2010-08-26 Thread Roelof Wobben
hello, I have this programm # Add your doctests here: """ >>> a_list[3] 42 >>> a_list[6] 'Ni!' >>> len(a_list) 8 """ a_list = ['test', 'test','test',42,'test','test','Ni!','test'] print a_list[3] print a_list[6] print len(a_list) if __name__ == '__main__': import doctes

Re: [Tutor] question about lists and doctest

2010-08-26 Thread Nitin Das
The doctest module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work exactly as shown. Here ur a_list[3] in docstring is 42 then doctest expects it to be 42 for success. Since u changed 42 to 16 then it is not = 42 as p

[Tutor] SSH session problems with network devices

2010-08-26 Thread davidheiserca
I have Python code that opens a telnet session with a network device and performs a multitude of tasks. Now, I am trying to establish and maintain an SSH connection as an alternative to telent. My research has found that the SSH implementation some network device manufacturers use is not consis

[Tutor] exercise problem

2010-08-26 Thread Roelof Wobben
Hello, I have this exercise: Lists can be used to represent mathematical vectors. In this exercise and several that follow you will write functions to perform standard operations on vectors. Create a file named vectors.py and write Python code to make the doctests for each function pass. W

Re: [Tutor] exercise problem

2010-08-26 Thread Emile van Sebille
On 8/26/2010 12:02 PM Roelof Wobben said... Hello, I have this exercise: Lists can be used to represent mathematical vectors. In this exercise and several that follow you will write functions to perform standard operations on vectors. Create a file named vectors.py and write Python code to m

Re: [Tutor] SSH session problems with network devices

2010-08-26 Thread James Mills
On Fri, Aug 27, 2010 at 2:54 AM, wrote: > My Paramiko code works correctly when connecting with a Linux system. But > when I connect with a router, the connection is dropped immediately after a > command is exectued, so it isn't possible to send a sequence of interrelated > commands. What Router

Re: [Tutor] SSH session problems with network devices

2010-08-26 Thread James Mills
On Fri, Aug 27, 2010 at 8:42 AM, wrote: > > I'm running tests on - Cisco IOS Software, s72033_rp Software > (s72033_rp-ADVIPSERVICESK9_WAN-M), Version 12.2 > > It's running SSHv2.0 > > My solution should be portable to other vendor/models. Can you "normally" ssh into your Cisco routers and be pr

Re: [Tutor] exercise problem

2010-08-26 Thread Alan Gauld
"Roelof Wobben" wrote Write a function add_vectors(u, v) that takes two lists of numbers I think that u is the name of the new list and v is the number which represent the number which must be eveluated. No. It sounds like you don't really understand the basic concepts behind functions yet

Re: [Tutor] SSH session problems with network devices

2010-08-26 Thread Steven D'Aprano
On Fri, 27 Aug 2010 02:54:27 am davidheise...@gmail.com wrote: > I have Python code that opens a telnet session with a network device > and performs a multitude of tasks. Now, I am trying to establish and > maintain an SSH connection as an alternative to telent. My research > has found that the SSH

Re: [Tutor] SSH session problems with network devices

2010-08-26 Thread James Mills
On Fri, Aug 27, 2010 at 9:13 AM, wrote: > > Yes. No problem. The point is that I have Python programs that normally > access these devices by telnet to complex tasks. I have to find a way to use > SSH to replace the telnet in my code. I actually have no experience with Cisco devices, but the que

[Tutor] question about import statement

2010-08-26 Thread Bill Allen
I was experimenting with Tk today, just trying it out. I found this example of a very simple "hello world" button click program. This is it. from tkinter import * from tkinter import ttk root = Tk() button = ttk.Button(root, text="Hello World").grid() root.mainloop() What I don't understand is

Re: [Tutor] question about import statement

2010-08-26 Thread Bill Allen
On Thu, Aug 26, 2010 at 7:44 PM, Corey Richardson wrote: > Why don't you try it out without the "from tkinter import ttk" statement, > and see if it works? > > Bill Allen wrote: > >> I was experimenting with Tk today, just trying it out. I found this >> example of a very simple "hello world" bu

Re: [Tutor] question about import statement

2010-08-26 Thread Bill Allen
> > On Thu, Aug 26, 2010 at 7:44 PM, Corey Richardson wrote: > >> Why don't you try it out without the "from tkinter import ttk" statement, >> and see if it works? >> >> Bill Allen wrote: >> >>> I was experimenting with Tk today, just trying it out. I found this >>> example of a very simple "hel

Re: [Tutor] question about import statement

2010-08-26 Thread Hugo Arts
On Thu, Aug 26, 2010 at 9:16 PM, Bill Allen wrote: > > I did try that and of course it gave an error because it was necessary.  I > just did not know why.   However, I later found an explanation on the web. > Here it is: > > from tkinter import * > from tkinter import ttk > > These two lines tell

Re: [Tutor] question about import statement

2010-08-26 Thread Greg Bair
On 08/26/2010 10:29 PM, Hugo Arts wrote: > On Thu, Aug 26, 2010 at 9:16 PM, Bill Allen wrote: >> >> I did try that and of course it gave an error because it was necessary. I >> just did not know why. However, I later found an explanation on the web. >> Here it is: >> >> from tkinter import * >>

Re: [Tutor] question about import statement

2010-08-26 Thread Hugo Arts
On Thu, Aug 26, 2010 at 11:18 PM, Greg Bair wrote: > On 08/26/2010 10:29 PM, Hugo Arts wrote: >> On Thu, Aug 26, 2010 at 9:16 PM, Bill Allen wrote: >>> >>> I did try that and of course it gave an error because it was necessary.  I >>> just did not know why.   However, I later found an explanation

Re: [Tutor] question about import statement

2010-08-26 Thread Steven D'Aprano
On Fri, 27 Aug 2010 02:18:10 pm Greg Bair wrote: > > yeah, "from package import *" doesn't actually import every name > > from a module. For example, by default, names starting with an > > underscore are not imported. Alternatively, if you have a variable > > named __all__ in your module, and it's