-2
lastPosition = GPS.getActualPosition()

I m trying to compile a code which is about sending sms through telit module.

above statement is giving an error. I couldn't understand, GPS library is in the place where it's supposed to be and I imported it.

import SER
import MOD
import MDM
import GPS

syntaxError: invalid syntax

http://forum.sparkfun.com/viewtopic.php?f=13&t=20038 please help!!!

4
  • 3
    You would have to give more code. Chance is the error is somewhere else. Commented Aug 28, 2010 at 22:15
  • 2
    Please post the entire error, including traceback, as well as all the relevant code. "Invalid syntax" doesn't help us, because the syntax for the code you posted is fine. Commented Aug 28, 2010 at 22:20
  • forum.sparkfun.com/viewtopic.php?f=13&t=20038 john_melbourne PostPosted: Sun Feb 28, 2010 6:55 pm here is the script , I just want to see how I can execute the phyton scripts. I uploaded and compiled another script but it was simple script. I m trying to execute this one. I want to take SMSes when I called the module. img841.imageshack.us/img841/7357/errrx.png here is the error Commented Aug 28, 2010 at 22:29
  • I deleted that gps thing and put there an gpsacp string. then it gave an error again in SER.send statement Commented Aug 28, 2010 at 22:34

2 Answers 2

2

The post the OP referred to (in a comment -- not a great idea, @gheddo! edit your Q instead!), here, has exactly this code (I'm copying and pasting only the two relevant lines):

def get_gps():
gpspos = GPS.getActualPosition() #Read GPS position

see the problem? No indentation for the second line! Therefore, a syntax error: function bodies (and other bodies of compound statements) must be indented in Python.

It was hardly necessary to send us reading that code, you know... the code's author, John Melbourne, in the very next post in this thread says, and I quote:

Hi again Ryan,

The forum software removed the indentation from the Python script that I listed in my earlier mail.

You will need to re-indent the function bodies, if and while statements. See Flavio's original source if your not sure how.

So that's exactly what you have to do -- re-indent the function bodies, if and while statements, and refer to Flavio Bernardotti's code if you need to for this purpose.

Also, in the future, I would strongly recommend you read at least one post later in a thread (if reading the whole thread is too much work for you...;-)...

Sign up to request clarification or add additional context in comments.

1 Comment

=) thanks a lot. it seems, the problem was my poor vocabulary =) thanks again.
-2

Perhaps try some text editor with visible white-space? I've had pesky bugs like this until I turn on "Show Invisibles" in TextMate.

1 Comment

is there another way to compile this script? I uploaded a sms_send script with txt extension and I enabled it, then I used execscr command. it worked and sent me a text. but this procedure didnt work for this script or I couldnt make it . when I called the module, terminal shows RING sign but SER libs and other parts dont work.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.