Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #44240
| Return-Path | <python@mrabarnett.plus.com> |
|---|---|
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.020 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'example:': 0.03; 'attribute': 0.07; 'string': 0.09; '23,': 0.16; 'filename.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'line)': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'subject:Problem': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'trying': 0.19; 'file,': 0.19; '(the': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'skip': 0.24; 'header:In-Reply-To:1': 0.27; 'object.': 0.31; 'file': 0.32; 'open': 0.33; 'call.': 0.33; 'but': 0.35; 'returning': 0.36; 'method': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'remove': 0.60; 'read': 0.60; 'first': 0.61; "you've": 0.63; 'skip:n 10': 0.64; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'subject:skip:A 10': 0.78; 'reply- to:addr:python.org': 0.84; '2013': 0.98 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.1 cv=TZ6v63gh c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=7AxPfEIvyrUA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=ISNvgD0zC6AA:10 a=U_ReUrDrCItk1BLSAawA:9 a=wPNLvfGTeEIA:10 |
| X-AUTH | mrabarnett:2500 |
| Date | Wed, 24 Apr 2013 02:17:48 +0100 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: AttributeError Problem |
| References | <4dfb3ca3-a539-48ec-aae8-0be22471cea4@googlegroups.com> <mailman.1008.1366761732.3114.python-list@python.org> <18292d0f-1f6f-411a-b348-a5f292e2af51@googlegroups.com> |
| In-Reply-To | <18292d0f-1f6f-411a-b348-a5f292e2af51@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | python-list@python.org |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1009.1366766452.3114.python-list@python.org> (permalink) |
| Lines | 34 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1366766452 news.xs4all.nl 2170 [2001:888:2000:d::a6]:59883 |
| X-Complaints-To | abuse@xs4all.nl |
| Path | csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder3.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
| Xref | csiph.com comp.lang.python:44240 |
Show key headers only | View raw
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.askopenfilename() >> >> >> >> This is just returning a filename. You need to open it to get a file >> >> object. For example: >> >> >> >> infile = filedialog.askopenfilename() >> >> fd = open(infile) >> >> ... >> >> numberOfVertices = int(fd.readline().decode()) >> >> >> >> Skip > Thanks, but now I have this error AttributeError: 'str' object has no attribute 'decode' > You already have a string (the line) that you've read from the file, so what are you trying to 'decode' anyway? Just remove that erroneous method call.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
AttributeError Problem animemaiden <animemaiden21@gmail.com> - 2013-04-23 16:41 -0700
Re: AttributeError Problem animemaiden <animemaiden21@gmail.com> - 2013-04-23 16:42 -0700
Re: AttributeError Problem Skip Montanaro <skip@pobox.com> - 2013-04-23 19:02 -0500
Re: AttributeError Problem animemaiden <animemaiden21@gmail.com> - 2013-04-23 17:28 -0700
Re: AttributeError Problem MRAB <python@mrabarnett.plus.com> - 2013-04-24 02:17 +0100
csiph-web