Re: AttributeError Problem

2013-04-23 Thread MRAB
On 24/04/2013 01:28, animemaiden wrote: On Tuesday, April 23, 2013 8:02:08 PM UTC-4, Skip Montanaro wrote: > numberOfVertices = int(infile.readline().decode()) # Read the first line from the file > AttributeError: 'str' object has no attribute 'readline' ... > infile = filedialog.askopen

Re: AttributeError Problem

2013-04-23 Thread animemaiden
On Tuesday, April 23, 2013 8:02:08 PM UTC-4, Skip Montanaro wrote: > > numberOfVertices = int(infile.readline().decode()) # Read the first line > > from the file > > > AttributeError: 'str' object has no attribute 'readline' > > ... > > > infile = filedialog.askopenfilename() > > > > Thi

Re: AttributeError Problem

2013-04-23 Thread Skip Montanaro
> numberOfVertices = int(infile.readline().decode()) # Read the first line from > the file > AttributeError: 'str' object has no attribute 'readline' ... > infile = filedialog.askopenfilename() This is just returning a filename. You need to open it to get a file object. For example: in

Re: AttributeError Problem

2013-04-23 Thread animemaiden
On Tuesday, April 23, 2013 7:41:27 PM UTC-4, animemaiden wrote: > Hi, > > > > I'm trying to display a graph in Tkinter that reads a graph from a file and > displays it on a panel which the first line in the file contains a number > that indicates the number of vertices (n). The vertices are l

AttributeError Problem

2013-04-23 Thread animemaiden
Hi, I'm trying to display a graph in Tkinter that reads a graph from a file and displays it on a panel which the first line in the file contains a number that indicates the number of vertices (n). The vertices are labeled as 0,1,…,n-1. Each subsequent line, with the format u x y v1, v2, …descr