While debugging in visual studio it runs but it doesn t show any error

0 votes

While debugging in visual studio it runs but it doesn't show any error

while True:
    r = mouse.position
    print(r)
    t = mouse.press
    #print(r, t)
    msg = pickle.dumps(r)
    msg = bytes(f"{len(msg):<{HEADERSIZE}}", 'utf-8')+msg
    clientsocket.send(msg)

When I connect this with the client... the network crashes. I think it's because I have to buffer this before sending. but have no idea how to do it

I'm new to socket

Nov 15, 2020 in Python by Rajiv
• 8,880 points
62 views

1 answer to this question.

0 votes

You're sending infinitely increasing data. Maybe it's because "while True"

think of a way to reformat this 
    msg = bytes(f"{len(msg):<{HEADERSIZE}}", 'utf-8')+msg

while True:
    r = mouse.position
    print(r)
    t = mouse.press
    #print(r, t)
    msg = pickle.dumps(r)
as I see these two highlighted lines are handling sending the mouse position. They should stay intact, but you can think of a way to move other lines outside the while loop

answered Nov 15, 2020 by Gitika
• 65,870 points

Related Questions In Python

+2 votes
2 answers

Error while printing hello world in python.

You must be trying this command in ...READ MORE

answered Mar 31, 2018 in Python by GandalfDwhite
• 1,320 points
1,222 views
0 votes
1 answer

Is there a foreach function in python and is there a way to implement it if there isnt any

Every occurence of "foreach" I've seen (PHP, ...READ MORE

answered Aug 31, 2018 in Python by charlie_brown
• 7,780 points
292 views
0 votes
0 answers

what is the use of visual studio 2015 tool in python?

What purpose would it serve being a ...READ MORE

Jun 7, 2019 in Python by Waseem
• 4,540 points
81 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,033 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
1,556 views
0 votes
1 answer

Python interpreter error: I have installed Python 3.8 but it shows version 3.7

Hi, While installing Python 3.8 there was a box ...READ MORE

answered Jul 2, 2020 in Python by Gitika
• 65,870 points
983 views
0 votes
1 answer

I am making a ai in python but there is a error

Hi, @Rhydham, Try this: engine = pyttsx3.init('dummy') READ MORE

answered Oct 12, 2020 in Python by Gitika
• 65,870 points
591 views