connect to ms sql server with odbc

Sean DiZazzo half.italian at gmail.com
Mon Aug 31 01:24:22 EDT 2009


On Aug 30, 10:08 pm, mierdatutis mi <mmm... at gmail.com> wrote:
> Hi,
>
> I'm newbie in python. I try to connect to remote server with ms sql
> server from my ubuntu. I install pyodbc and I do:
>
>  >>> conn = >>> Conn =
>  pyodbc.connect("DRIVER=
> {FreeTDS};SERVER=defekas62;UID=emuser;PWD=temporal;DATABASE=em620")
> pyodbc.connect ( "DRIVER = () FreeTDS; SERVER = defekas62; UID =
> emuser; PWD = temporal; em620 DATABASE =")
>  cursor = conn.cursor() cursor = conn.cursor ()
>  >>> for row in cursor.execute("select USERNAME from JOBACTIONS"): >>>
> Para la fila en cursor.execute ( "usuario seleccionar de
> JOBACTIONS"):
>  ... ... print row.USERNAME row.USERNAME de impresión
>    File "<stdin>", line 2 Archivo "<stdin>", línea 2
>      print row.USERNAME row.USERNAME de impresión
>          ^ ^
>  IndentationError: expected an indented block
> Why this error?
> Many thanks and sorry for my english

Welcome to python.  The error is telling you exactly what it says.
There is a block of code that is not indented properly.  Perhaps your
code was edited with two different editors?

Tabs are not equal to spaces.  Go thru your code and be sure that you
are consistent with all of your spacing.  I believe 4 spaces per
indent (without tabs) is the current Python standard.

~Sean



More information about the Python-list mailing list