Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #44237
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <skip.montanaro@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.018 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'example:': 0.03; 'attribute': 0.07; 'cc:addr:python-list': 0.11; 'filename.': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'subject:Problem': 0.16; 'sender:addr:gmail.com': 0.17; 'cc:addr:python.org': 0.22; 'skip': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'object.': 0.31; 'file': 0.32; 'open': 0.33; 'received:google.com': 0.35; 'returning': 0.36; 'read': 0.60; 'first': 0.61; 'skip:n 10': 0.64; 'to:addr:gmail.com': 0.65; 'subject:skip:A 10': 0.78 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=4uj4oE7e2bG8+913GuCYfU8psAUb3glocsALg6LyxNY=; b=z7XjCerIiyn79IUjlvjoNIuxJ6u4+r/kSWqLSGwmCTlcYfKRnWBMfkjNZq8zwwj+bs XertP+NCNyjA+voIJJKmYaHNXT5uqhhwHemOsd7Bt87AoshEL6ysqsMGQGxhJPAVtIkz tLwpG5Ci/TnLRSIYey4qWx5tZH0YpQ7u84OUt1PYdVPTwfAJDgDQxtisrWJv/U9ndMzI IU83zOm/Bs+OkfIveV1UF75ZG2xXd4iTOLi4P1eXASW58K571B5oO2NxSbQuup3LI+b7 MSC0fRnS3LVLFQzUjlpBUrpy2bZgIfJRPljdPdl5PGZ9adCRmLvHI8pqZxDsptEmYfAJ 0EOg== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.154.4 with SMTP id vk4mr12314549igb.29.1366761729056; Tue, 23 Apr 2013 17:02:09 -0700 (PDT) |
| Sender | skip.montanaro@gmail.com |
| In-Reply-To | <4dfb3ca3-a539-48ec-aae8-0be22471cea4@googlegroups.com> |
| References | <4dfb3ca3-a539-48ec-aae8-0be22471cea4@googlegroups.com> |
| Date | Tue, 23 Apr 2013 19:02:08 -0500 |
| X-Google-Sender-Auth | ZsMvjQ5AahG_0R5-ERJVKSrfFQw |
| Subject | Re: AttributeError Problem |
| From | Skip Montanaro <skip@pobox.com> |
| To | animemaiden <animemaiden21@gmail.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| 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.1008.1366761732.3114.python-list@python.org> (permalink) |
| Lines | 14 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1366761732 news.xs4all.nl 2246 [2001:888:2000:d::a6]:46528 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:44237 |
Show key headers only | View raw
> 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
Back to comp.lang.python | Previous | Next — Previous in thread | Next 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