[Tutor] puzzling traceback -- what to do with it?

2005-02-27 Thread Brian van den Broek
Hi all, I just ran a program of mine and got the traceback: Traceback (most recent call last): File "C:\PYTHON24\lib\idlelib\rpc.py", line 233, in asyncqueue self.putmessage((seq, request)) File "C:\PYTHON24\lib\idlelib\rpc.py", line 333, in putmessage raise IOError IOError This stumps

[Tutor] open a socket from a named file on linux

2005-02-27 Thread dm
Hello, I am trying to open a socket connection to a named file on my computer and can not seem to get it working. Any help or advice would be great. The details I attempting to control xfmedia, http://spuriousinterrupt.org/projects/xfmedia/ , via it's remote from python and I can not get a conne

Re: [Tutor] Learning python as a thing to do

2005-02-27 Thread Alan Gauld
> I am a Rubyist, but I've decided to learn Python Welcome, could be interesting. I'm a pythonista and have learned Ruby but not used it for anything significant yet. > At any rate, so far Python seems to be a very good > language. Not a great language, but still very good. There is only one

Re: [Tutor] 3 questions for my port scanner project

2005-02-27 Thread Alan Gauld
> > Use a canvas and redraw a rectangle slightly larger every > > time through the scanning loop. > > Thats think this is the easy part... > The hard part is to make the bar move "with" the program (so every > port it finishes the bar will slightly move, which depends on the > total number of ports

Re: [Tutor] Recursive Tkinter buttons

2005-02-27 Thread Jacob S.
Yay! Thanks for the tips Michael/Alan - works a treat, although I must admit, I'm not sure what Lambda does. Adam Lambda is basically a function without a name that can be used inline. Take for example, this code. def funct(x): return sin(x) is the same as funct = lambda x: sin(x) There seems to

Re: [Tutor] How do you share a method (function) among several objects?

2005-02-27 Thread Jacob S.
Is it possible to put all of those objects in their own module, having the function you describe as a module defined function? For example pseudo code ### Lib.py ### def function(x): return stuff class C1: def __init__(self): init stuff def funct(self,arg): return func

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Jeff Shannon
On Sun, 27 Feb 2005 17:55:54 +, Richard gelling <[EMAIL PROTECTED]> wrote: > > No What I get if I was to type in > ./arg1.py a b c > > All I get is > [] It sounds as though the command shell is not passing along the additional parameters. Try opening Windows Explorer, and go to the Folder

Re: [Tutor] Learning python as a thing to do

2005-02-27 Thread Danny Yoo
On Sun, 27 Feb 2005, Greg T wrote: > I am a Rubyist, but I've decided to learn Python so that when a > conversation springs up about the merits of the two languages amd how > they compare, I will be well informed. Hi Greg, Welcome aboard! That sounds great; you can help us understand Ruby bet

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Danny Yoo
> Add a file called 'test.cmd' in the same directory as your 'test.py' > program with the following content: > > ### > python test.cmd %* > ### Scratch that! *grin* Sorry, meant to write that the test.cmd should contain: ### python test.py %* ### Darn it, but I don't have a Windows box handy

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Danny Yoo
> >(I know I'm being a bit silly about asking about what looks like a > >simple email typo, but computer programming bugs are all-too-often > >about typos. *grin* > > Sorry for the late response, I tried all of the the suggestions, > including correcting my typo of print sys[1:] and tried print >

Re: [Tutor] Re: How do you share a method (function) among several objects?

2005-02-27 Thread Jeff Shannon
On Sun, 27 Feb 2005 20:20:19 +0200, Xif <[EMAIL PROTECTED]> wrote: > There are two major classes: > > 1) an Excel class, that represents of the whole Excel program > 2) a Cells class, that abstracts retrieval and editing of cells. > > [...] > > The difference between the 2 classes is that a Cel

[Tutor] Learning python as a thing to do

2005-02-27 Thread Greg T
Hi, I am a Rubyist, but I've decided to learn Python so that when a conversation springs up about the merits of the two languages amd how they compare, I will be well informed. As it stands now, what you usually see is people well versed in one or the other, making generalizations when they dont re

Re: [Tutor] Re: How do you share a method (function) among several objects?

2005-02-27 Thread Liam Clarke
yeah, I do the same thing for those useful functions that don't really fit anywhere else. I call it helperFunctions or something, so when your're importing helperFunctions and calling helperFunctions.getCells() it's pretty obvious what's happening. Liam Clarke On Sun, 27 Feb 2005 20:39:41 +0100

Re: [Tutor] SubClassing

2005-02-27 Thread Jeff Shannon
On Fri, 25 Feb 2005 05:54:39 -0200, Ismael Garrido <[EMAIL PROTECTED]> wrote: > def __init__(self, this, that, new): > Parent.__init__(self, this, that) #note self > self.new = new If the paren's init t has a lot of possible arguments, it may be easier to do things this way: class Child(

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Liam Clarke
Yeah, python.exe is the right one... bizarre... I'll have a poke at it when I get home from work. Sorry I haven't been more helpful. Cheers, Liam Clarke On Sun, 27 Feb 2005 18:57:30 +, Richard gelling <[EMAIL PROTECTED]> wrote: > > Hi, > > It is actually associated with just 'python', ch

Re: [Tutor] Re: How do you share a method (function) among several objects?

2005-02-27 Thread Pierre Barbier de Reuille
The position to put it is a design choice and there is no single best solution. What I'd do is to gather all the small "homeless" functions in a single separate module. And if they come to be too numerous, I'll sort them in some modules, ... But that's because I don't like having a single funct

[Tutor] Re: How do you share a method (function) among several objects?

2005-02-27 Thread Jorge Godoy
Xif <[EMAIL PROTECTED]> writes: > Ok, so keeping getCells() as an external function makes sense. > > But where exactly do you recommend I'd put it? > > In a seperate module, like I currently do, even though it's going to be the > only piece of code contained inside that module? I don't see any

Re: [Tutor] Recursive Tkinter buttons

2005-02-27 Thread Adam Cripps
On Sun, 27 Feb 2005 16:06:32 -, Alan Gauld <[EMAIL PROTECTED]> wrote: > > - however, when I click the button, I want self.showButton to know > > which one of them was pressed. I've seen in other gui programming > the > > idea of an id or identifier - I can't see that here. Ideally, I > would >

Re: [Tutor] 3 questions for my port scanner project

2005-02-27 Thread Mark Kels
On Sun, 27 Feb 2005 16:00:12 -, Alan Gauld <[EMAIL PROTECTED]> wrote: > One option: > Use a set up gif images and update the image periodically > OR > Use a canvas and redraw a rectangle slightly larger every > time through the scanning loop. Thats think this is the easy part... The hard part

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Richard gelling
Hi, It is actually associated with just 'python', changed it to associate with 'pythonw' and I got nothing on the same example not even the [], so I am assuming that 'python' is the correct one? Liam Clarke wrote: Yeah, right click on a .py and check if it's associated with pythonw or python.

Re: [Tutor] Re: How do you share a method (function) among several objects?

2005-02-27 Thread Xif
Ok, so keeping getCells() as an external function makes sense. But where exactly do you recommend I'd put it? In a seperate module, like I currently do, even though it's going to be the only piece of code contained inside that module? Xif Pierre Barbier de Reuille wrote: Well, for me, the more lo

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Richard gelling
Hi, It is actually associated with just 'python', changed it to associate with 'pythonw' and I got nothing on the same example not even the [], so I am assuming that 'python' is the correct one? Liam Clarke wrote: Yeah, right click on a .py and check if it's associated with pythonw or pyth

Re: [Tutor] Re: How do you share a method (function) among several objects?

2005-02-27 Thread Pierre Barbier de Reuille
Well, for me, the more logical answer is : multi-inheritance ! If part of your class is the same, (same semantic, same implementation), then you want to have a base class for that. If you dislike this kindof inheritance, then your function should be an external one. Even more because it's 'just'

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Liam Clarke
Yeah, right click on a .py and check if it's associated with pythonw or python.exe GL, Liam Clarke On Sun, 27 Feb 2005 18:28:18 +, Richard gelling <[EMAIL PROTECTED]> wrote: > Hi, > Yes, I use both Wndows XP and Linux( at work ) . I left that in by > mistake I am actually just typing in >

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Richard gelling
Hi, Yes, I use both Wndows XP and Linux( at work ) . I left that in by mistake I am actually just typing in arg1,py a b c at the windows XP command prompt Sorry for the confusion. Liam Clarke wrote: Are you using XP still? I've never seen this before - ./arg1.py a b c But anyhoo, I tri

Re: [Tutor] Re: How do you share a method (function) among several objects?

2005-02-27 Thread Liam Clarke
You could a real generic superclass for the classes, it only needs to contain that one function. Personally, I see nothing wrong with chucking one function in a module on it's own, it's whatever works for you. You could create a class for it also, and give each of the other classes an instance of

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Liam Clarke
Are you using XP still? I've never seen this before - > ./arg1.py a b c But anyhoo, I tried out just 'c:\python23\foo.py' as opposed to 'c:\python23\python foo.py' and while foo.py will run, it doesn't echo to the console, as on my machine running a .py file runs it through pythonw.exe - I'd

Re: [Tutor] Re: How do you share a method (function) among several objects?

2005-02-27 Thread Xif
Javier Ruere wrote: Xif wrote: Hello There are several different objects. However, they all share the same function. Since they are not the same or similar, it's not logical to use a common superclass. So I'm asking, what's a good way to allow those objects to share that function? The best solution

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Richard gelling
Hi, No What I get if I was to type in ./arg1.py a b c All I get is [] If i type at the command prompt python arg1.py a b c I get ['a','b','c'] as expected All the other programs and examples I have typed in work fine just by typing in the file name, I don't have to preced the file name with pyt

[Tutor] Re: How do you share a method (function) among several objects?

2005-02-27 Thread Javier Ruere
Xif wrote: Hello There are several different objects. However, they all share the same function. Since they are not the same or similar, it's not logical to use a common superclass. So I'm asking, what's a good way to allow those objects to share that function? The best solution I've found so far i

[Tutor] How do you share a method (function) among several objects?

2005-02-27 Thread Xif
Hello There are several different objects. However, they all share the same function. Since they are not the same or similar, it's not logical to use a common superclass. So I'm asking, what's a good way to allow those objects to share that function? The best solution I've found so far is to put th

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Nick Lunt
Richard, if you try to print sys.argv[1:] when sys.argv only contain sys.argv[0] then you are bound to get an empty list returned, [] . Im not sure I understand the problem you think you've got but here's what happens with sys.argv for me, and it's correct. [argl.py] $ cat argl.py #!/usr/bin/py

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Richard gelling
Danny Yoo wrote: I am reading ' Learning Python second edition' by Mark Lutz and David Ascher, and I trying the code examples as I go along. However I am having a problem with the following, which I don't seem to be able to resolve :- # test.py import sys print sys[ 1: ] This I believe

Re: [Tutor] 3 questions for my port scanner project

2005-02-27 Thread Mark Kels
On Sun, 27 Feb 2005 03:24:07 -0800 (PST), Shitiz Bansal <[EMAIL PROTECTED]> wrote: > > The ports which do not respond are the ones which take > most of the time.You can use the timer object to fix > the time for each port.For eg. if a port does not > respond within .1 sec it can reasonably be expe

Re: [Tutor] Recursive Tkinter buttons

2005-02-27 Thread Alan Gauld
> - however, when I click the button, I want self.showButton to know > which one of them was pressed. I've seen in other gui programming the > idea of an id or identifier - I can't see that here. Ideally, I would > like to know the value of i in self.showButtons - but when I use > self.showButtons

Re: [Tutor] 3 questions for my port scanner project

2005-02-27 Thread Alan Gauld
> Here are the questions (-: > 1. How do I make a progress bar in Tkinter ? One option: Use a set up gif images and update the image periodically OR Use a canvas and redraw a rectangle slightly larger every time through the scanning loop. The first is easiest the second smoother but much more wor

Re: [Tutor] Recursive Tkinter buttons

2005-02-27 Thread Michael Lange
On Sat, 26 Feb 2005 19:48:25 + Adam Cripps <[EMAIL PROTECTED]> wrote: > On Fri, 25 Feb 2005 12:21:18 +0100, Michael Lange > > > > > You see, in my example above I called the list "buttonlist" instead of > > "button"; maybe this naming > > helps avoid confusion . > > > > Best regards > >

Re: [Tutor] 3 questions for my port scanner project

2005-02-27 Thread Shitiz Bansal
> 2. I got a while loop which does the port scan > itself. How can I end > it while its working ? using the break statement anywhere inside the loop will exit the loop. > 3. For some reason the scan is too slow (2-3 seconds > for a port). Is > there a way to make it faster (other port scanner >