Thursday, November 28, 2019

Re:

Hi man,

plz show err msg.

On Thu, Nov 28, 2019, 18:08 RAJAT MAAN <rajat1996maan@gmail.com> wrote:


can someone help me where I am getting wrong? Unable to compare df1 == df2.


import mysql.connector as mysql
import socket
import sys  

def server_program():
HOST = '192.168.0.115' 
PORT = 8888
 
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

print('socket created')

try:
    s.bind((HOST, PORT))
except socket.error as err:
    print('Bind Failed, Error Code: ' + str(err[0]) + ', Message: ' + err[1])
    sys.exit()
 
print('Socket Bind Success!')
 
s.listen(10)
print ('Socket is now listening')
 
 
while 1:
    conn, addr = s.accept()
    print ('Connect with ' + addr[0] + ':' + str(addr[1]))
    df1 = conn.recv(1024).decode()
    print(df1)
    break
    conn.close()
s.close()

mydb=mysql.connect(
user = 'rajat',
    passwd = 'rajat',
    host = 'localhost',
    database = 'myforum'
)

mycursor=mydb.cursor()
mycursor.execute("SELECT * FROM form_simpleform WHERE id=1")

df2=mycursor.fetchone()
print(df2)

if df1 == df2:
print('yes Data Exists')
else:
print('No Data')

if __name__ == '__main__':
    server_program() 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4ef1565c-9f61-4da3-beb2-cb4176556ae6%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP5HUWo9UwgrEugAqgzcNzC_y4XkbHYWcm2%3D%3D713pCRG%3DXMcHQ%40mail.gmail.com.

No comments:

Post a Comment