Re: [Tutor] Python to C++

2008-03-24 Thread Tony Cappellini
Another alternative is Weave http://www.scipy.org/Weave But mixing C/C++ with Python sort of defeats the reasons for using Python to begin with Message: 2 Date: Sat, 22 Mar 2008 02:44:54 +0100 From: Eike Welk <[EMAIL PROTECTED]> Subject: Re: [Tutor] Python to C++ To: tutor@python.org Message-ID:

Re: [Tutor] Let imported module access calling program

2008-03-24 Thread Shrutarshi Basu
> This seems kind of strange to me. You want the entire user module to be > re-run? Why don't you want looping and timing to be under the user's > control? Can you show a short example of what the user code might look like? > > Kent > Well perhaps not the entire module, but probably most of i

Re: [Tutor] Let imported module access calling program

2008-03-24 Thread Kent Johnson
Shrutarshi Basu wrote: > I'm working on a module-based robot interface, but I've hit a bit of a > roadblock. I would like the user's script to be able to simply import > modules and drive the robot. I want the users code to be executed once > every few seconds, but I don't want the timing system to

[Tutor] Let imported module access calling program

2008-03-24 Thread Shrutarshi Basu
I'm working on a module-based robot interface, but I've hit a bit of a roadblock. I would like the user's script to be able to simply import modules and drive the robot. I want the users code to be executed once every few seconds, but I don't want the timing system to be part of the users code: the

Re: [Tutor] what is @classmethod and @staticmethod ??

2008-03-24 Thread Andreas Kostyrka
A classical example is a class that can be constructed from different values. Ok, let's implement a special integer class: class MyOwnInteger(object): def __init__(self, value): self.value = value Now, let's say we want to add the possibility to create MyOwnInteger instances from str

Re: [Tutor] cross-compile python?

2008-03-24 Thread Michael Langford
Cross compiling python isn't easy. Follow what this blogger did to get started, then ask when you get stuck. http://whatschrisdoing.com/blog/2006/10/06/howto-cross-compile-python-25/ --Michael On Mon, Mar 24, 2008 at 1:04 AM, Trey Keown <[EMAIL PROTECTED]> wrote: > Hey all, > I've s

Re: [Tutor] how to write a function

2008-03-24 Thread Marc Tompkins
On Mon, Mar 24, 2008 at 6:28 AM, Bartruff, Pamela J. < [EMAIL PROTECTED]> wrote: > Def convert_time(time): > """split hours from minutes" > Time = raw_input("enter a time, in military: ") > At this point, Time is a string, not a number. (At this point, we also have to _assume_ that the user ente

Re: [Tutor] CSV file processing...

2008-03-24 Thread Spencer Parker
I took out the quotes around the second part of the INSERT statement and that made it work fine. On Mon, Mar 24, 2008 at 10:49 AM, Spencer Parker <[EMAIL PROTECTED]> wrote: > Okay...so I don't know what I was missing...but I copied the code from a > file I had without the loop in it...now it work

Re: [Tutor] CSV file processing...

2008-03-24 Thread Spencer Parker
Okay...so I don't know what I was missing...but I copied the code from a file I had without the loop in it...now it works just fine...I'm going through to see what changed right now...thanks for the help...it is appreciated... On Mon, Mar 24, 2008 at 10:30 AM, Kent Johnson <[EMAIL PROTECTED]> wrot

Re: [Tutor] CSV file processing...

2008-03-24 Thread Kent Johnson
Spencer Parker wrote: > I am pretty sure it is trying to tell me that the data I have is not > matching up with the columns I have in mysql. Yes, I think so. > > The output I get from the print next is this: > > ['test.test.net ', '15:33:59', 'x86_64', '8', '9', > '1', '4

Re: [Tutor] CSV file processing...

2008-03-24 Thread Spencer Parker
I am pretty sure it is trying to tell me that the data I have is not matching up with the columns I have in mysql. The output I get from the print next is this: ['test.test.net', '15:33:59', 'x86_64', '8', '9', '1', '4', '0', '0', '0', '0', '5', '4', '0.0', '12495360', '818688', '0', '36', 'core.

Re: [Tutor] CSV file processing...

2008-03-24 Thread Kent Johnson
Spencer Parker wrote: > Okay...that got me a different error: > _mysql_exceptions.OperationalError: (1136, "Column count doesn't match > value count at row 1") So, what do you think that error might be trying to tell you? What output do you get from the 'print next' statement? Kent __

Re: [Tutor] CSV file processing...

2008-03-24 Thread Spencer Parker
Okay...that got me a different error: Traceback (most recent call last): File "./loadcsv.py", line 21, in ? co.execute(""" File "/usr/lib64/python2.4/site-packages/MySQLdb/cursors.py", line 163, in execute self.errorhandler(self, exc, value) File "/usr/lib64/python2.4/site-packages/M

Re: [Tutor] CSV file processing...

2008-03-24 Thread Kent Johnson
Spencer Parker wrote: > I am at a loss as to why this isn't working properly: > > #!/usr/bin/python > > import MySQLdb > import csv > import sys > > try: > db = MySQLdb.connect (host = "localhost",user = "root",passwd = > "",db = "stats") > except MySQLdb.Error, e: > print "Erro

Re: [Tutor] how to write a function

2008-03-24 Thread Bartruff, Pamela J.
Thank you so much. I appreciate the help, I am very new to Python, but I would very much like to learn more... -Original Message- From: bhaaluu [mailto:[EMAIL PROTECTED] Sent: Monday, March 24, 2008 9:17 AM To: Bartruff, Pamela J. Cc: tutor@python.org Subject: Re: [Tutor] how to write a

Re: [Tutor] CSV file processing...

2008-03-24 Thread Spencer Parker
I am at a loss as to why this isn't working properly: #!/usr/bin/python import MySQLdb import csv import sys try: db = MySQLdb.connect (host = "localhost",user = "root",passwd = "",db = "stats") except MySQLdb.Error, e: print "Error %d: %s" % (e.args[0], e.args[1]) sys.exit (

Re: [Tutor] how to write a function

2008-03-24 Thread bhaaluu
On Mon, Mar 24, 2008 at 8:07 AM, Bartruff, Pamela J. <[EMAIL PROTECTED]> wrote: > > Hello Python users, > > I am very new to Python, how do I program that converts 24 hour time to 12 > hour time? The program should have three functions(input, conversion and > output function) > > Thanks for any he

Re: [Tutor] how to write a function

2008-03-24 Thread Bartruff, Pamela J.
Def convert_time(time): """split hours from minutes" Time = raw_input("enter a time, in military: ") If hours > 12 Hours = hours - 12 Am_or_pm = "p.m." Output_hours = hours Output_minutes = minutes Output_hours = "" Else: Am_or_pm = "a.m." -Original Message- From: Kent Johnson [mailto:[

Re: [Tutor] how to write a function

2008-03-24 Thread Kent Johnson
Bartruff, Pamela J. wrote: > Hello Python users, > > I am very new to Python, how do I program that converts 24 hour time to > 12 hour time? The program should have three functions(input, conversion > and output function) This sounds like a homework assignment. We will help with homework but

[Tutor] how to write a function

2008-03-24 Thread Bartruff, Pamela J.
Hello Python users, I am very new to Python, how do I program that converts 24 hour time to 12 hour time? The program should have three functions(input, conversion and output function) Thanks for any help Pamela Bartruff ___ Tutor maillist -