[Tutor] error binding parameter 1

Dinesh B Vadhia dineshbvadhia at hotmail.com
Sun Nov 25 03:18:40 CET 2007


Yes, it should be: image_blob = open(image_file, 'rb').read()

Thank-you!


----- Original Message ----- 
From: bob gailer 
To: Dinesh B Vadhia 
Cc: tutor at python.org 
Sent: Saturday, November 24, 2007 5:55 PM
Subject: Re: [Tutor] error binding parameter 1


Dinesh B Vadhia wrote:
> Hello!  Can anyone see what the problem with this code snippet is?
>  
> Dinesh
>  
> ------------------------------------------------------------------------
>             image_filename = str(dir_list[i])
>             image_file = dir_path + image_filename
>             image_blob = open(image_file, 'rb')
Should that be
image_blob = open(image_file, 'rb').read()?
> [L40]   cursor.execute("Insert into image_table values (?, ?)", 
> (image_filename, image_blob))
>  
> Traceback (most recent call last):
>   File "C:\storage management.py", line 40, in <module>
>     cursor.execute("Insert into image_table values (?, ?)", 
> (image_filename, image_blob))
> InterfaceError: Error binding parameter 1 - probably unsupported type.
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071124/a4c5b34f/attachment.htm 


More information about the Tutor mailing list