list - Python: ValueError: invalid literal for int() with base 10: '' error -


i have code reads info file (lines describe points, polygons, lines , circles) , parses according class. point has x , 7 coordinates , line has starting point , end point.

i have list (line = ['l1','l((1,1), (1,2))','# comment']) , try make line. problem creating end point, when executing following error valueerror: invalid literal int() base 10: '' fr variable x2

what problem?

code:

def make_line(line):         name = line[0]         point = line[1].split(", ")         p = point[0].split(",")         x1 = int(p[0][3:])         y1 = int(p[1][:-1])         point1 = point(x1,y1)         p = point[1].split(",")         x2 = int(p[0][1:])         y2 = int(p[1][:-2])         point2 = point(x2,y2)         line = line(point1,point2)         shapes[name] = line 

you error message says trying convert empty string int. double check data before doing conversion verify this.

it absolute certainty if data correct, cast integer work. therefore, conclusion drawn data incorrect. claiming in comments question data good, cannot true.

trust python interpreter on own assumptions.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -