Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: >>> %matplotlib inline results in SyntaxError: invalid syntax Date: Fri, 29 Jan 2016 18:32:58 +1100 Lines: 28 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de z6VcDda5et65PijGdRiOVAo72zx9A+TDcmmDRRe1cUhQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'win32': 0.03; 'cc:addr :python-list': 0.09; 'python': 0.10; 'jan': 0.11; 'syntax': 0.13; 'interpreter': 0.15; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'magic': 0.16; 'numpy': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:inline': 0.16; 'syntaxerror:': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'suggested': 0.20; 'not,': 0.22; 'bit': 0.23; 'dec': 0.23; 'slightly': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'install': 0.25; 'command': 0.26; 'error': 0.27; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'skip:( 20': 0.28; 'actual': 0.28; 'mike': 0.29; 'random': 0.29; '(including': 0.30; 'work.': 0.30; 'code': 0.30; 'probably': 0.31; 'certain': 0.31; 'idle': 0.33; 'running': 0.34; 'received:google.com': 0.35; 'should': 0.36; 'lines': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'there,': 0.37; 'received:209.85.213': 0.37; 'starting': 0.37; 'things': 0.38; 'doing': 0.38; 'received:209': 0.38; 'inline': 0.63; 'more': 0.63; 'percent': 0.66; 'python-list': 0.66; 'chrisa': 0.84; 'route': 0.84; 'to:none': 0.91; 'different.': 0.91; 'subject:results': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=IegObjaT40MlVw73OFiDnFzv7rrbOaFLoDIGZXCpb8k=; b=qTmeu8hbWKXPEFG0tYsL9GJh5d769U0Kin2X3TFK+wx3R4gcCX3dZgSBoaTGLfqKYp pJ1FYY4GHBWZSsFNiEeJ7VBKZACZW87dHHUOeu6eG7bxUpWc/y+6iQ2PWfR/BBdecB/I FY5rPErgvXuDA+SU8YF7aXXM8gxitzEpJ68Go47TWUISwWkz38jpu+gXY4ipVpNstFyH iJ0WmYLZATtsEP4Te5UM1asV7cyHKyEfnILriJqkU5iVErLqRYVyjD45er/xyxKOZMip 1S7g4TKXQbTknBVs7Yro28n1kp0EskvDnUmYWct+XmDkQad2wLTk/srr0NLrExjuSJLJ 06DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-type; bh=IegObjaT40MlVw73OFiDnFzv7rrbOaFLoDIGZXCpb8k=; b=Qrg0vzKzYNRoM0dBJeFjWckdDLFtDZcZY0B9c8sQ3gBGJT46DZfmgcDREsxYaRzDH6 ETAefYmyvsYrU7/iyXq4t/nyZKDxvS/YweA44cLY3J0D22lkV5Bipk/BJp9oRR0jrSZY 5wtVw74XkcSTQ5uVCFXz4Qatc7ZZNQXUxUlE4gI15GVMRb9b3E0GoHpz3ejGZUcMgTOy cJXHAjblw3W1hGDm+mw/BDpF/+7GAeRTw090a60h7pT6IINF3dNqgqq8lQL/VhBkfzCD JCw5vtmBdxNo06GJBKceoOqDms2AGLBC6Jk2lTQzZBv9LdDYIiz3N/LpcBNHTtFhBjZs zNfQ== X-Gm-Message-State: AG10YOSkC0zxTX5Pe+FQ/ZalsDMcuFV3Qw9Kh+VefFexOaQJ45NWYLJ1F3s9O50mKBWqn/m8xNijeDOIW+qReg== X-Received: by 10.50.111.169 with SMTP id ij9mr8338624igb.92.1454052778226; Thu, 28 Jan 2016 23:32:58 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:102217 On Fri, Jan 29, 2016 at 6:04 PM, Mike S via Python-list wrote: > > I get an error on the last line. I am running this code in Idle Python 3.4.4 > Shell... > > Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit > (Intel)] on win32 > Type "copyright", "credits" or "license()" for more information. >>>> import numpy as np >>>> import pandas as pd >>>> import random >>>> import matplotlib.pyplot as plt >>>> %matplotlib inline > SyntaxError: invalid syntax > > What am I doing wrong? Suggested reading? That's a magic command for ipython - it's not actual Python syntax. You can either install ipython and do the exercises there, or continue with Idle and accept that things will be slightly different. Skim through a few more of the examples; do you see more lines starting with percent signs? If not, you can probably get away with using any interactive Python interpreter (including Idle as you're using above). Alternatively, take the certain route and install ipython - then everything should work. ChrisA