Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 how to send an image from server to client using PICKLE module
I have this sqlite3 database table in the server side that contains a BLOB object:

q_conn = sqlite3.connect('questions_stack.db')
q_c = q_conn.cursor()
q_c.execute("""CREATE TABLE IF NOT EXISTS questions (
topic TEXT,
username TEXT,
likes INTEGER,
pic BLOB)

The client sends an image file in pieces by opening it 'rb':

f = open(pic_path, "rb")
l =
while l:
l =

and the server saves the image as post_pic file, and inserts the image object by opening it as 'wb' to the database column pic BLOB:

f = open('post_pic'+".jpg", 'wb') # open in binary
l = client.recv(1024)
while l != "stop" and l != "nopic":
l = client.recv(1024)

I tried sending the table questions data to the client (so he could create a GUI) using pickle module:


q_conn = sqlite3.connect('questions_stack.db')
q_conn.text_factory = str
q_c = q_conn.cursor()
q_c.execute("SELECT * FROM questions")
feed = q_c.fetchall()
data = pickle.dumps(feed)

Client side:

d = client_socket.recv(BUFSIZ)
feed = pickle.loads(d)

However, I got this error on the client-side:

feed = pickle.loads(d)

raise ValueError, "insecure string pickle"
ValueError: insecure string pickle

Do you have any idea what the problem is? and how can I fix it? I'd really appreciate it if you could help me!

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  how can i send a list of tuples from the server to the client using sockets? dafdaf 1 149 Apr-13-2020, 10:51 PM
Last Post: Larz60+
  Python script multi client server sonra 1 212 Mar-24-2020, 03:49 PM
Last Post: Larz60+
  simple udp server/client cardmaker 2 563 Nov-26-2019, 12:36 AM
Last Post: micseydel
  Slow websockets server -> client pattagghiu 0 399 Sep-17-2019, 09:28 AM
Last Post: pattagghiu
  Chat (Client-Server) andresdrr 3 835 Aug-26-2019, 02:01 PM
Last Post: ThomasL
  Python server(Django web site)/client(Python app) connection Junior_Pythoneer 5 668 Jul-05-2019, 05:41 PM
Last Post: noisefloor
  How to combine data taken from server between client and GUI? bescf 9 1,566 Apr-02-2019, 11:48 AM
Last Post: bescf
  tcp server/client port connection issue valshev 2 2,606 Sep-01-2018, 02:50 PM
Last Post: valshev
  Send data BMP180 between client and server trought module socket smalhao 0 946 Jul-30-2018, 12:56 PM
Last Post: smalhao
  Sending/Receiving Multiple Message from Server or Client Lyperion 0 2,775 Jul-30-2018, 07:52 AM
Last Post: Lyperion

Forum Jump:

Users browsing this thread: 1 Guest(s)