Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 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; 'cc:addr :python-list': 0.15; 'received:74.125.82.44': 0.15; 'received :mail-ww0-f44.google.com': 0.15; 'syntax': 0.15; '"here': 0.16; '"here\'s': 0.16; 'subject:question': 0.16; 'wrote:': 0.16; 'issue.': 0.19; 'cc:no real name:2**0': 0.21; 'maybe': 0.21; 'header:In-Reply-To:1': 0.22; 'fine,': 0.23; 'command': 0.24; 'hey': 0.24; 'shell': 0.24; 'cc:2**0': 0.25; 'saying': 0.25; 'pm,': 0.26; 'import': 0.27; "i'm": 0.27; 'script': 0.28; 'idle': 0.28; 'weird': 0.28; 'print': 0.29; 'cc:addr:python.org': 0.29; 'second': 0.29; 'syntax,': 0.30; 'txt': 0.30; 'you!!': 0.30; 'error': 0.30; 'about.': 0.32; 'actually': 0.32; "can't": 0.32; 'message-id:@gmail.com': 0.33; 'header:User-Agent:1': 0.33; 'received:74.125.82': 0.34; '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:74.125': 0.37; 'received:google.com': 0.37; 'received:192': 0.38; "what's": 0.39; 'doing': 0.39; 'subject:: ': 0.39; '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=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=ccmaxE0EA+BqNWi21iCWtsUAABPPirwCZ7HjWA8DfB8=; b=vqEkzV/swRx1Zz2AHNwQj519L25WaT7TEfDN61so1FVtnbf5e+Jue2+vHiZyxFfJ7I 7iazFQHfJU5wrskj54aBdcikgCFiF7hag4mQ1oXKS4hXIuyjvhTkUDNL3BIqDjhIwjQ3 iahEAGtlR2kIul4/IynXSDtl+rWJHYbP0fqmI= Date: Thu, 26 Jan 2012 22:11:11 +0000 From: Andrea Crotti User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111224 Thunderbird/9.0.1 MIME-Version: 1.0 To: Matty Sarro Subject: Re: Weird newbie question References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1327615881 news.xs4all.nl 6889 [2001:888:2000:d::a6]:33287 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19505 On 01/26/2012 10:05 PM, Matty Sarro wrote: > 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!! Let me try, maybe you're running the IDLE for Python 3 and the shell for python 2?