Popo
Popo

Reputation: 11

Data too long Mysql and python

MYSQL Error , while sending from android to python the GPS Latitude and longititude

enter code here

def pacman(self):

     while True:

      while True:

        try:
            x1=self.sockfd.recv(2048)
            print x1
            print "\n hi"
            conn.begin()
            x.execute("UPDATE location SET x='%s'"%(x1))
            print "hi"
            y1=self.sockfd.recv(2048)
            print y1
            x.execute("UPDATE location SET y='%s'"%(y1))
            conn.commit()

        except ValueError:
                   self.sockfd.send("\nError202:That is not a valid Car Number")

DataError: (1406, "Data too long for column 'y' at row 1") // data appear 31.3363510530.0845932431.3363510530.0845932431.33635105 !! Despite not every time its do so what should be done ?

Upvotes: 0

Views: 1234

Answers (2)

Tudor Constantin
Tudor Constantin

Reputation: 26861

Try with varchar 256 it looks like a mysql error

Upvotes: 3

Femaref
Femaref

Reputation: 61437

Change your column definition so all possible values fit in it.

Upvotes: 0

Related Questions