Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8622653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:06:36+00:00 2026-06-12T07:06:36+00:00

This is not working when I want to access int(COORDINATES 2 ) it’s not

  • 0

This is not working when I want to access int(COORDINATES2) it’s not working. How do i fix this? i am trying to access the COODINATES which now have become a global scope

import socket
import os,sys
import time
from threading import Thread

HOST = '59.191.193.59'
PORT = 5555

COORDINATES = []

def connect():   
    globals()['client_socket'] = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client_socket.connect((HOST,PORT))

def update_coordinates():
    connect()
    screen_width = 0
    screen_height = 0
    while True:
        try:
            client_socket.send("loc\n")
            data = client_socket.recv(8192)
        except:
            connect();
            continue;

        globals()['COORDINATES'] = data.split()

        if(not(COORDINATES[-1] == "eom" and COORDINATES[0] == "start")):
            continue

        if (screen_width != int(COORDINATES[2])):
        screen_width = int(COORDINATES[2])
                screen_height = int(COORDINATES[3])   

Thread(target=update_coordinates).start()

while True:
    print 'ball x' , int(COORDINATES[2])

this is the error i got enter image description here
enter image description here

and if i change my code to this:

    import socket
import os,sys
import time
from threading import Thread

HOST = '59.191.193.59'
PORT = 5555

COORDINATES = []

def connect():   
    globals()['client_socket'] = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client_socket.connect((HOST,PORT))

def update_coordinates():
    connect()
    screen_width = 0
    screen_height = 0
    while True:
        try:
            client_socket.send("loc\n")
            data = client_socket.recv(8192)
        except:
            connect();
            continue;

        globals()['COORDINATES'] = data.split()

        if(not(COORDINATES[-1] == "eom" and COORDINATES[0] == "start")):
            continue

        if (screen_width != int(COORDINATES[2])):
        screen_width = int(COORDINATES[2])
                screen_height = int(COORDINATES[3]) 

    print int(COORDINATES[8])  

Thread(target=update_coordinates).start()

and this is what i get:

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:06:37+00:00Added an answer on June 12, 2026 at 7:06 am

    This line:

    Thread(target=update_coordinates()).start()
    

    Should read:

    Thread(target=update_coordinates).start()
    

    You’ve provided the result of your function as the value for target, rather than providing the function itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know i can do something similar to this (not working) code
I want to display data from database in DataGridView...This is my code...Its not working...Can
This is not working and it is driving me nuts. I have in the
This is probably a simple one... Right now I have a working web service
I'm trying to access a samba share that requires authentication. I do not want
Why is this not working $(this).parents(tr).find(td:eq(2)).html() I cant seam to get the text getthis
So why is this not working? I'm creating a regex that will match a
This is not working. Firebug is not throwing any error though. HTML: <table> <tr><td>BookA</td><td><a
On whatever reason this is not working (says 'file not found'), set in=c:\myprogram\_save cd
Why is this thing not working? [Database(Name=Relationships_Test)] [Table(Name = Order)] public class Order {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.