why do i get this error File main py line 18 message connectionSocket recv 1024 IndentationError expected an indented block and how to make it write

0 votes

print ("Ready to serve...")

connectionSocket, addr = serverSocket.accept()

try:

message = connectionSocket.recv(1024)

print message,'::',message.split()[0],':',message.split()[1]

filename = message.split()[1]

print filename,'||',filename[1:]

f = open(filename[1:])

Sep 8, 2020 in Python by anonymous
• 120 points
2,258 views

1 answer to this question.

0 votes

Hello,

The error itself explain what's the problem.In Python, all the code that you type is arranged via correct whitespaces and therefore if at any instance you have a bad indentation, the overall code will not run and the interpreter will simply return an error function.

Make those changes and your code will work fine.

To know more what is indentation error you can refer this:https://www.edureka.co/blog/indentation-error-in-python/

Hope this helps!!

Thank you!!

answered Sep 8, 2020 by Niroj
• 82,840 points

Related Questions In Python

0 votes
1 answer

I was written the python program, am getting error message "IndentationError: expected an indented block"

Hi@Thiyagarajan, You have one else block in your ...READ MORE

answered May 27, 2020 in Python by MD
• 95,460 points
3,549 views
0 votes
1 answer

I've been trying to run this code, but the error says "Expected an indented block" for the line, " word_as_list[index] = guess."

Hi, @Paradox, The error message IndentationError: expected an indented ...READ MORE

answered Nov 21, 2020 in Python by anonymous
• 65,770 points
1,080 views
–1 vote
2 answers
0 votes
1 answer

I want to download a file from the website by web scraping. Can anyone explain how to do this in jupyter lab (python) with an example?

Hey, Web scraping is a technique to automatically ...READ MORE

answered Apr 7, 2020 in Python by Gitika
• 65,770 points
2,387 views
0 votes
1 answer

what does this line fout.write("</{}>\n".format(opentags.pop())) do?

It closes one tag actually, opentags is ...READ MORE

answered Nov 10, 2020 in Python by Gitika
• 65,770 points
630 views
0 votes
1 answer

what do you mean by static block in java?

Static block is used for initializing the ...READ MORE

answered Jun 18, 2018 in Java by scarlett
• 1,290 points
893 views
0 votes
1 answer

cant get around error ''expected an indented block'' in python(jupyter lab)

Hi@David, First thing, don't share your credentials with ...READ MORE

answered Nov 19, 2020 in Data Analytics by MD
• 95,460 points
776 views
0 votes
1 answer

How do I get the path and name of the file that is currently executing?

Hello @kartik, Since Python 3 is fairly mainstream, ...READ MORE

answered May 11, 2020 in Python by Niroj
• 82,840 points
2,641 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP