Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19504

Weird newbie question

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <msarro@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'interpreter': 0.05; 'sys': 0.05; 'complaining': 0.07; 'script,': 0.07; 'python': 0.08; 'appreciated,': 0.09; "book's": 0.09; 'filename': 0.09; 'to:name:python list': 0.09; 'received:209.85.214.174': 0.13; 'syntax': 0.15; '"here': 0.16; '"here\'s': 0.16; 'subject:question': 0.16; 'issue.': 0.19; 'fine,': 0.23; 'command': 0.24; 'hey': 0.24; 'saying': 0.25; 'import': 0.27; "i'm": 0.27; 'script': 0.28; 'message-id:@mail.gmail.com': 0.28; 'idle': 0.28; 'weird': 0.28; 'print': 0.29; 'second': 0.29; 'syntax,': 0.30; 'txt': 0.30; 'you!!': 0.30; 'error': 0.30; 'about.': 0.32; 'actually': 0.32; 'received:209.85.214': 0.32; "can't": 0.32; 'to:addr:python-list': 0.33; 'thank': 0.35; 'running': 0.35; 'something': 0.35; 'issue': 0.35; 'file': 0.35; 'everyone.': 0.36; 'run': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; "what's": 0.39; 'received:209': 0.39; 'doing': 0.39; 'to:addr:python.org': 0.40; 'type': 0.60; 'your': 0.61; '"learn': 0.91; 'quotation': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=q+bKemASL0m5Um9Pb3b6YrNYKeWOroBtmzxpF/zLUHg=; b=xc7j5YneW2s2p/OzseTKS7YMVYSzD7biRmU24pFyCfZC57anLRJMhLkUd/So2okGKu Jxz/fwdLPZi7EyL9bEtflI3Ohh+F2DlJFUG/JMYftbt9L0qiJgMnaQeLyJlpLrZY0tpG C5GzBbs90JO/sSDI5slPfhomxWlgPCaMSACZU=
MIME-Version 1.0
Date Thu, 26 Jan 2012 17:05:57 -0500
Subject Weird newbie question
From Matty Sarro <msarro@gmail.com>
To Python list <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.5138.1327615560.27778.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1327615560 news.xs4all.nl 6918 [2001:888:2000:d::a6]:58957
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19504

Show key headers only | View raw


Hey everyone. I'm running into a funky error as I work through "Learn
Python the Hard Way." What's weird is both idle and the python
interpreter in idle spit out an error about syntax, but when I run the
same script from the command line it works just fine, with no issue.
I'm not sure if its an issue with IDLE or if I'm doing something
wrong.

Here's the book's code:

from sys import argv
script, filename = argv
txt = open(filename)
print "Here's your file %r:" % filename
print txt.read()
print "Type the filename again:"
file_again = raw_input("> ")
txt_again = open(file_again)
print txt_again.read()

Here's my code:

from sys import argv
script,filename=argv
txt=open(filename)
print "Here is your file %r:" % filename
print txt.read()
print "I'll also ask you to type it again:"
file_again=raw_input("> ")
txt_again=open(file_again)
print txt_again.read()


IDLE is saying that my error is on line 4, at the second set of
quotation marks. Since I can't get the error from the command line, I
can't actually see what the syntax error is that it's complaining
about. Any advice would really be appreciated, thank you!!

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Weird newbie question Matty Sarro <msarro@gmail.com> - 2012-01-26 17:05 -0500
  Re: Weird newbie question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-26 22:27 +0000
  Re: Weird newbie question John Gordon <gordon@panix.com> - 2012-01-26 22:35 +0000
  Re: Weird newbie question Rick Johnson <rantingrickjohnson@gmail.com> - 2012-01-26 14:53 -0800
    Re: Weird newbie question Matty Sarro <msarro@gmail.com> - 2012-01-26 20:51 -0500

csiph-web