Invalid Syntax... Again. D:

I am getting an invalid syntax error for this:

from GameLogic import *

from socket import *

cont = GameLogic.getCurrentController()

own = cont.owner



own["Connect"] = 120



if own["OneTime"] == 0:

	ServerIP = GameLogic.IP

	ServerPort = 10000

	Clientname = ''

	ClientPort = 10001

	GameLogic.sStart = socket(AF_INET,SOCK_DGRAM)

	GameLogic.sStart.bind((Clientname,ClientPort))

#The one under is the invalid syntax line...

	GameLogic.host = (ServerIP,ServerPort)

	GameLogic.sStart.setblocking(0)

	own["OneTime"] = 1

	

Maybe you meant to use brackets (or whatever these [ ] are called) instead of parentheses?

I dunno… I looked at OldJim’s script and he uses perentheses, but that was for 2.48… Did the API get changed for that?

(I think those are tuples…)

changed to brackets… Same thing:

Blender Game Engine Started

Python error compiling script - controller "Connect.py#CONTR#2":
  File "Connect", line 23
    GameLogic.host = (ServerIP,Serverport)
            ^
SyntaxError: invalid syntax

Blender Game Engine Finished

In the python documentation tuples only have parentheses if they’re nested- for example


blah = 1, 'other value', 3, ('this second tuple', 'is nested'), 'some stuff'

So what do I do?!

It appears to have a problem with the GameLogic.host… Not the variables. Because I also got the error for GameLogic.host = ServerIP

Sometimes the error isn’t necessarily on the line number specified, that may just be when the error caused a problem. This happens a lot if you do something like forgetting an end parenthesis.

So is that code copy/pasted from what you have, or is it demonstrative code?

I copy/pasted your code into Blender and got no errors. Are you sure the code is exactly the same?

Yes. It was copy-pasted… :confused:

Maybe the name is reserved??

i discivered that in my file in a couple of lines i left stuff out like perentheses…

i wonder why the other one worked…