Re: [Python-mode] compile problem in emacs

Discussion in 'Python' started by vissen@gmx.net, Feb 13, 2004.

  1. Guest

    hi

    i am new to Linux and Python.

    I get a syntax error for this line of code.
    ......
    def fib(n): # write Fibonacci series up to n
    .........

    used Emacs as the editor on a Redhat ver8.0 OS. (This example is included as
    part of tutorial/documentation in Python docs)
    any suggestions /ideas are useful.
    thanks for reading.



    --
    -Vissen

    GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
    jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++
    , Feb 13, 2004
    #1
    1. Advertising

  2. Peter Otten Guest

    wrote:

    > i am new to Linux and Python.


    Welcome to both!

    >
    > I get a syntax error for this line of code.
    > .....
    > def fib(n): # write Fibonacci series up to n
    > ........
    >
    > used Emacs as the editor on a Redhat ver8.0 OS. (This example is included
    > as part of tutorial/documentation in Python docs)
    > any suggestions /ideas are useful.
    > thanks for reading.


    The code snippet is correct. Here's what your code *could* look like

    <syntaxerror.py>
    def test(

    def fib(n): # write Fibonacci series up to n
    """Print a Fibonacci series up to n."""
    a, b = 0, 1
    while b < n:
    print b,
    a, b = b, a+b
    </syntaxerror.py>

    This will show the following slightly misleading syntax error:

    File "<stdin>", line 3
    def fib(n): # write Fibonacci series up to n
    ^
    SyntaxError: invalid syntax

    but I cannot be sure, because your post doesn't provide enough context.
    In the future, please give a small but _complete_ example that shows the
    erroneous/undesired behaviour and the _actual_ traceback (cut and paste
    from emacs or the command line).

    Peter
    Peter Otten, Feb 13, 2004
    #2
    1. Advertising

  3. Could you post more complete source code or error message?
    Yen-Ting Chen, Feb 13, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John J Lee
    Replies:
    3
    Views:
    470
    bruno at modulix
    Dec 1, 2005
  2. Edward Loper
    Replies:
    0
    Views:
    458
    Edward Loper
    Aug 7, 2007
  3. Jeffrey Moss

    eruby mode emacs with mmm-mode

    Jeffrey Moss, Jul 6, 2005, in forum: Ruby
    Replies:
    1
    Views:
    146
    Alan Chen
    Jul 6, 2005
  4. PerlFAQ Server
    Replies:
    1
    Views:
    190
    Marc Girod
    Jan 8, 2011
  5. PerlFAQ Server
    Replies:
    0
    Views:
    163
    PerlFAQ Server
    Apr 12, 2011
Loading...

Share This Page