Re: SQLObject

2009-09-29 Thread CCW
On Sep 28, 9:41 pm, Daniel Fetchinson 
wrote:
> > I'm new to using SQLObject, and having some problems with getting it
> > to recognise my current MySQL database.
>
> > I've set up my connection fine, but it won't recognise the names of
> > the columns (presumably because they're not written using the default
> > naming convention?).  For example, one of my columns is an acronym, so
> > is 3 uppercase letters.  I've tried the following:
>
> > class Table1(sqlobject.SQLObject):
> >   _connection = conn
> >   _fromDatabase = True
>
> >   class sqlmeta:
> >      table = 'Table1'
> >      idName = 'Table1ID'
>
> >   BOB = StringCol()
>
> > print Table1.get(1)
>
> > this gives the result
>
> > Unknown column 'bo_b' in 'field list'
>
> > So, specifically a few questions:
>
> > I've seen the attribute in class sqlmeta of 'columns' - will this find
> > my column names automatically, or do I still need to input them
> > manually? If the latter..:
>
> > I assume I set the names of each column in the instance of sqlmeta
> > (like I have done with the table name) - how do I do this?! Do I do
> > this before or after I've told SQLObject that the BOB column is a
> > String column?
>
> > Is there a published list of the default naming convention that
> > SQLObject follows? I couldn't find it on the website.
>
> The current maintainer of sqlobject is Oleg Broytmann and he
> frequently answers support questions on the sqlobject mailing list so
> it's best to ask questions such as these over 
> there:https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>
> HTH,
> Daniel
>
> --
> Psss, psss, put it down! -http://www.cafepress.com/putitdown

Thanks for this - have reposted there.

Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multiple versions of python

2009-07-21 Thread CCW
On 21 July, 15:19, Dave Angel  wrote:
> ChrisW wrote:
> > Hi,
>
> > I have installed 2 versions of python on my Windows XP computer - I
> > originally had 3.0.1, but then found that the MySQL module only
> > supported 2.*, so I've now installed that.  I have found that if I
> > change the Windows Environment Variable path, then I can change the
> > version of python called when I type 'python' into a command line.
> > However, I'd like to be able to choose which version I use.  I know
> > that if I change C:\Python26\python.exe to
> > C:\Python26\python2.exe and C:\Python30\python.exe to C:
> > \Python26\python3.exe, then typing 'python2' or 'python3' will invoke
> > the correct interpreter.  However, is it safe just to rename the
> > executable files? Is there a more elegant way to achieve the same
> > task?
>
> > Thanks,
> > Chris
>
> The elegant way is to have a batch directory on your PATH ( I use  
> m:\t\bat )  and put your *.bat files there.   I do NOT put any python
> installations on the PATH.
>
> For example, I have a batch file called:     m:\t\bat\python26.bat
>
> c:\progfiles\python26\python.exe %*
>
> The %* syntax means pass all arguments through to the program.
>
> Once it all works, you can add an "@" in front of the c:   in order to
> suppress echoing the command.  At that point, it'll look and work the
> same way as what you did, but without modifying anything in the install
> directory.    (You may want  python26.bat, pythonw26.bat, python31.bat
> and pythonw31.bat)
>
> The other thing you may want to do in a batch file is to change the file
> associations so that you can run the .py file directly, without typing
> "python" or "pythonw" in front of it.
>
> The relevant Windows commands are:     assoc and ftype      And on a
> related note, you may want to edit the PATHEXT environment variable, to
> add .PY and .PYW

Thanks for this - this way made a bit more sense to me.  I've now got
C:\commands with the 4 .bat files in, and C:\commands in my path.  It
all seems to work :) I think I've missed the point of the @ though -
it doesn't seem to make any difference..

I'm also a bit confused with the associations - since I've got python
2.6 and 3.1, surely the command I type (python26 or python31) is the
only way to force a script to be run using a specific interpreter at
runtime without having to change the .bat file every time I want to
run a script using 3.1 instead of 2.6?
-- 
http://mail.python.org/mailman/listinfo/python-list