Re: Access to CAN-Bus

2008-06-09 Thread John Schroeder
Isn't a CAN bus accessed via the COM ports (serial or parallel)? If this is the case, then you should use pySerial and/or pyParallel but you would have to define the protocol yourself. (I've used pyserial to implement a LAPB protocol.) On Mon, Jun 9, 2008 at 12:15 AM, Diez B. Roggisch <[EMAIL PR

Re: waiting on an event blocks all signals

2008-05-17 Thread John Schroeder
^C only kills the main thread. Use Control-Break to kill all threads. On Sat, May 17, 2008 at 12:32 PM, alan <[EMAIL PROTECTED]> wrote: > This ignores CTRL-C on every platform I've tested: > > python -c "import threading; threading.Event().wait()" > ^C^C^C^C > > It looks to me like all signals a

Re: How can I add spaces where ever I have capital letters?

2008-05-08 Thread John Schroeder
I do like one-liners and do not like regexps! That code puts mine to shame... Thanks for the tip. I'll use that one instead. On Thu, May 8, 2008 at 7:40 PM, Dan Bishop <[EMAIL PROTECTED]> wrote: > > On Thu, May 8, 2008 at 9:12 PM, John Schroeder <[EMAIL PROTECTED]>

Re: How can I add spaces where ever I have capital letters?

2008-05-08 Thread John Schroeder
gt; wrote: > Something like this. I'm sure there are other ways to do it. > > import re > > def addspace(m) : >return ' ' + m.group(0) > > strng = "ModeCommand" > > newstr = re.sub('[A-Z]',addspace,strng) > > print n

How can I add spaces where ever I have capital letters?

2008-05-08 Thread John Schroeder
I have a string (which I got from the names of my classes) and I would like to print out my CamelCase classes as titles. I would like it to do this: >>> my_class_name = "ModeCommand" ## Do some magic here >>> my_class_name 'Mode Command' Anyone know any easy way to do this? Thanks. -- http://ma

Re: Troubles with 'self'

2008-05-08 Thread John Schroeder
I think you need to make an instance of your class. Try this: my_class_instance = DataAnalysis() LogFile = my_class_instance.BasicSummary ( ) On Thu, May 8, 2008 at 7:07 AM, Richard Speaker < [EMAIL PROTECTED]> wrote: > I'm somewhat new to Python... and programming in general. I know enough to

Re: Given a string - execute a function by the same name

2008-05-08 Thread John Schroeder
You can do it with a class using the __getattr__ function. There might be a way to do it without a class but I don't how to do it that way. class AllMyFunctions(object): def a(self): print "Hello. I am a." def b(self): print "Hey. I'm b." x = raw_input("Enter a functio

How can we write a class factory that dynamically redefines the __init__ function etc.

2008-05-05 Thread John Schroeder
Basically I have some classes like this: ### # 0x01: ModeCommand ### class ModeCommand: """This is the Mode Command Packet class.""" def