Syntax Error, help a newbie 
Author Message
 Syntax Error, help a newbie

Hi,

I am a newbie to python. I am in need of executing a setup script which is
written in this language.

self._services = [ s for s in self._services: if s._name != '$removed$' ]
                               ^
SyntaxError: invalid syntax

I can't figure out what is the mistake in this sentence. Any help will be
very useful. Thanks.

Regards, Ismael

PS. Red Hat Linux 7.2 running python-1.5.2-38



Mon, 25 Apr 2005 17:22:38 GMT  
 Syntax Error, help a newbie

Quote:

> I am a newbie to python. I am in need of executing a setup script
> which is
> written in this language.

> self._services = [ s for s in self._services: if s._name !=
> '$removed$' ]

That colon shouldn't be there, for starters:

        [f(x) for x in L if g(x)]

--

 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ No man who needs a monument ever ought to have one.
\__/ Nathaniel Hawthorne
    7 Sisters Productions / http://www.7sisters.com/
 Web design for the future.



Mon, 25 Apr 2005 17:27:25 GMT  
 Syntax Error, help a newbie
Quote:
> self._services = [ s for s in self._services: if s._name !=

'$removed$' ]

[sniped]

Quote:
> PS. Red Hat Linux 7.2 running python-1.5.2-38

Even if your syntax were correct, it wouldn't work. python 1.52 didn't
have list comprehensions.

Cheers,
Brian



Mon, 25 Apr 2005 18:22:12 GMT  
 Syntax Error, help a newbie

Quote:
> Do you mean, my syntax is not correct? :)

Yeah; get rid of the colon. Also, are you expecting some kind of
variable expansion with '$removed$'?

Quote:
> My problem is that the code is not written by myself.
> Is part of a big platform which I am supossed to
> support. I am used to shell scripts but not to Python
> at all.

There are a few Python tutorials. The official one is:
http://www.python.org/doc/current/tut/tut.html

Quote:
> I have reviewed previous support messages and now I
> see that Python 2.2 is required. The package
> python2-2.2-16 is installed in my system. Does this
> mean I should deinstall python-1.5.2-38?

Don't install Python 1.5.2. The operating system needs it to be there.

Cheers,
Brian



Tue, 26 Apr 2005 03:22:41 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Super-newbie syntax error question

2. newbie syntax help..

3. regex newbie help request (py syntax coloring)

4. inline assembler error - porting Intel syntax to AT&T syntax

5. still have syntax error in line 14, pls help

6. syntax error : Help :-((

7. HELP--- SYNTAX ERROR (Limit) Name Table Full---

8. SQL Syntax errors, please help

9. help--syntax error

10. HELP: syntax error

11. Literal error and syntax error

12. Error 47 HELP Clarion Newbie

 

 
Powered by phpBB® Forum Software