Re: [Tutor] Handling MySQLdb exceptions

2007-12-19 Thread Joshua Simpson
On Dec 19, 2007 10:14 AM, Paul Schewietzek <[EMAIL PROTECTED]> wrote: > > Is there any way to handle this exception? As you can see, I already > tried it with _mysql_exceptions.OperationalError (the lines that are > commented out), but _mysql_exceptions is not defined to Python > > "Operationa

Re: [Tutor] Bound To Be A Typo

2007-12-17 Thread Joshua Simpson
On Dec 17, 2007 12:16 PM, earlylight publishing < [EMAIL PROTECTED]> wrote: > > class Critter(object): > """A virtual pet""" > def ___init___(self, name): > print "A new critter has been born!" > > You're using 3 underscores before and after 'init'. The constructor for Python cla

Re: [Tutor] Check if root

2007-09-29 Thread Joshua Simpson
On 9/28/07, Robert Jackson <[EMAIL PROTECTED]> wrote: > > I'm trying to write a function that checks to see if the user that > is running the python script is 'root' (I'm obviously running this > Python program on Linux). Why not just use os.geteuid() ? import os if os.geteuid() != 0: print "

Re: [Tutor] for vs while

2007-09-28 Thread Joshua Simpson
On 9/28/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > > It's worth your time learning about Python data structures and for > loops. They are very powerful and useful and unlike anything built-in to > C. With a background in C you should find the official tutorial pretty > easy to read: > http://d

Re: [Tutor] for vs while

2007-09-28 Thread Joshua Simpson
On 9/28/07, James <[EMAIL PROTECTED]> wrote: > > > # doesn't work > for i in len( stuff ): > os.system( stuff[ i ] ) > j = i + 1 > print stuff[ j ] > > > Traceback (most recent call last): >File "", line 1, in > TypeError: 'int' o

Re: [Tutor] Getting the type of a variable

2006-10-27 Thread Joshua Simpson
  On 10/27/06, Etrade Griffiths <[EMAIL PROTECTED]> wrote: Hi I want to check the type of a variable so that I know which format to use for printing egAlternatively, you could just cast it as a string.  ___ Tutor maillist - Tutor@python.org http