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

Thank-you!


----- Original Message ----- 
From: bob gailer 
To: Dinesh B Vadhia 
Cc: tutor@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@python.org
> http://mail.python.org/mailman/listinfo/tutor
>   

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to