Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: [Python-mode] compile problem in emacs (http://www.velocityreviews.com/forums/t328276-re-python-mode-compile-problem-in-emacs.html)

vissen@gmx.net 02-13-2004 07:33 AM

Re: [Python-mode] compile problem in emacs
 
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 +++



Peter Otten 02-13-2004 09:04 AM

Re: [Python-mode] compile problem in emacs
 
vissen@gmx.net 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

Yen-Ting Chen 02-13-2004 12:33 PM

Re: [Python-mode] compile problem in emacs
 
Could you post more complete source code or error message?


All times are GMT. The time now is 06:46 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.