Re: Arguement error

2005-09-01 Thread Jeffrey Maitland
Found the error.  It was not in the code at all it has to do with the fact that the String module has a translate method and it was being used not the one I wrote. Thanks again.On 8/31/05, Terry Reedy <[EMAIL PROTECTED]> wrote: "Jeffrey Maitland" <[EMAIL PROTECTED]> wrote

Arguement error

2005-08-31 Thread Jeffrey Maitland
Hello folks, I am wondering why I am getting this error. when I try to run a script. TypeError: translate() takes at most 3 arguments (10 given) but the thing is the method translate actually accepts 10 arguements. That is what is confusing me. Jeff -- http://mail.python.org/mailman/listinf

Re: threads and sleep?

2005-07-06 Thread Jeffrey Maitland
Thanks for the info. I was doing some more diggging and I came across a module/class called POSH which should allow me to do what I want. My question now is, has anyone here used this and if so what it as easy to implement as what I am reading it is? (I have to wait for the sys admin to install

Re: threads and sleep?

2005-07-05 Thread Jeffrey Maitland
Thanks. I was hoping that python would allow for the cpu threading such in Java etc.. but I guess not. (from the answers,and other findings) I guess I will have to write this part of the code in something such as java or c or something that allows for it then I can either wrap it in python or avoi

Re: threads and sleep?

2005-07-05 Thread Jeffrey Maitland
Hello all, First off Thanks for the responses on the sleep() part I suspected as much but I wasn't 100% sure. To continue this I just want to pre thank anyone that contributes to this thread(lol). Ok here goes. The problem I have is I had an application (wrote/co-wrote) that has a long run time

threads and sleep?

2005-07-04 Thread Jeffrey Maitland
Hello all, I am in the process of writing a multithreading program and what I was wondering is a sleep command in an executing function will affect the threads below it? Here is a basic example of what I mean. def main(): temp_var = True while temp_var == True: if t = threa

Re: Seeking IDE

2005-06-30 Thread Jeffrey Maitland
I am currently using synEdit. That is because it is a free, small, and very customizable and highlites pythn keywords.(and was on the system at work) Where as at home I use Emacs, or GNUEmacs (depends on which boot up I chose at the time). Jeff -- http://mail.python.org/mailman/listinfo/python

Got an interesting problem. (platform ruuning issue)

2005-06-29 Thread Jeffrey Maitland
when running scripts they seem to work fine on ia-32 but I get segfault on ia-64 what the heck should I be looking for? I did notice that it seems to work ok only for certain scripts but any script that imports MySQLdb or glob seems to make this occur. Thanks Jeff -- http://mail.python.org/mailm

Re: Favorite non-python language trick?

2005-06-24 Thread Jeffrey Maitland
1 trick I liked in C++ was for For loops. { for(int i = 0; i < 100; i++){ //do stuff } } wrapping the for loop in { } makes the i a local variable and then you can use it again in the code if not you will get a variable already defined error. As a side note python already keeps it a local var

Re: how to use more than 1 __init__ constructor in a class ?

2005-06-22 Thread Jeffrey Maitland
Well one way to do this (not sure if it is the best way) is something like. class mypoint: def __init__(self, *args): len_args = len(args) print len_args if len_args == 0: self.x = 0 self.y = 0 self.z = 0 elif len_args >=2 and len_args <= 3:

Re: What is different with Python ?

2005-06-16 Thread Jeffrey Maitland
Well as for the communication skills dropping. I highly doubt that, if anything you are just picking up on things you never noticed before (and your communication skills far surpass the average person that writes anything in todays' society). A good example for me is that I am noticing that I

RE: change extensions

2005-04-05 Thread Jeffrey Maitland
That approach works, but so does this one. import os, glob input_file_list = glob.glob('*.txt') for in_file in input_file_list: name = in_file.split('.') os.rename(in_file, str(name[0]) + '.' + 'text')) # I could have put the text extension with the period but if you use a variable (st

Class, object question.

2005-04-05 Thread Jeffrey Maitland
Hello folks,   The question I am having is something like this.   # ignore the precursing ….  I am using them for easy message formatting   from point import *   Class vector(point): ..def __init___(self, point1, point2): …..self.i = point2.get_x() - point1.get_x()

Data problem

2004-12-15 Thread Jeffrey Maitland
Hello all, I am using the MySQLdb module and I am writing to a MySQL database. My write statement is something like. cursor.execute(“INSERT INTO Data(Name, X, Y, Z, Data)    VALUES('%s', '%s', '%s', '%f', '%f', '%f', '%s')""" %   

Re: how do I "peek" into the next line?

2004-12-13 Thread Jeffrey Maitland
[EMAIL PROTECTED] writes: Hi, suppose I am reading lines from a file or stdin. I want to just "peek" in to the next line, and if it starts with a special character I want to break out of a for loop, other wise I want to do readline(). Is there a way to do this? for example: while 1: line=stdin.

Re: how do I "peek" into the next line?

2004-12-13 Thread Jeffrey Maitland
Jeffrey Maitland writes: [EMAIL PROTECTED] writes: Hi, suppose I am reading lines from a file or stdin. I want to just "peek" in to the next line, and if it starts with a special character I want to break out of a for loop, other wise I want to do readline(). Is there a way to do

Re: question about modules

2004-12-10 Thread Jeffrey Maitland
Jon writes: Hi, The following four lines of code: import sys, os, re sentence = raw_input("Enter a sentence: ") capwords (sentence) print sentence gives me the following error: NameError: name 'capwords' is not defined As far as I can tell from the online docs, "capwords" should be defi

Re: How did you learn Python?

2004-12-03 Thread Jeffrey Maitland
Well I would suggest the Python in a Nutshell and the Python Cookbook both by O'Reilly as references. They are great for a desktop reference and I check them first before I google/search else where for answers. Being they are reference books they or more on aide then a teaching device however