Problem while running python script

Posted on 2013-01-19
Last Modified: 2013-02-10
I have written a program in python, while i am executing it gives a is the last lines of program where i am getting error.

if__name__  == "__main__"

File "./", line 23
IdentationError: unexpected ident
Question by:pawanopensource
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4

Author Comment

ID: 38796802
i think its a problem replated to spacing in program, i am not able to figure out though.
LVL 25

Accepted Solution

clockwatcher earned 500 total points
ID: 38796933
You're missing a colon at the end of your if statement.

if__name__  == "__main__"

Open in new window

should be:

if__name__  == "__main__":

Open in new window


Author Comment

ID: 38796951
here is the script and error screen short. plz let me know what mistake i have made.
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

LVL 25

Expert Comment

ID: 38797592
Ok... that's not the same error that you posted previously, but the error is pretty self explanatory.  It can't open the file passwords.txt which means either the file doesn't exist in your current directory or if it does, the user account that you're running as doesn't have permissions to it.

Author Comment

ID: 38797715
Yes you are right. passwords.txt dosent exist.

1 How to make password.txt in current directory
    vi /etc/passwd

2 How to give permission to the user abc.

LVL 25

Expert Comment

ID: 38797744
You can copy it there:

  cp /etc/password ./passwords.txt

To give read permission to it:

  chmod o+r ./passwords.txt

And I'm going to guess at your next question and tell you that you'll need a dictionary file in the same directory called dictionary.txt that contains a password guess per line.
LVL 25

Expert Comment

ID: 38797750
And lastly... you're using a system that is using shadow passwords.  Your /etc/passwd file doesn't contain the hashed passwords in it.  You'd probably want to run it against /etc/shadow.

Author Comment

ID: 38797755
i have created passwords.txt in the python 2.7 directory. when i am running this program there is no error. but it should prompt password found for user, which it is not doing so.

Author Comment

ID: 38797762
bro plz guide me, i know i am asking very basic things but plz consider it, as i am not a  
python guy or a programmer,i am kid in python or any programming language.

path where python is stored

root# cd /usr/lib/python2.7/

Plz guide me according to this path,

how to run /etc/passwd against /etc/shadow
how to copy passwords.txt
how to make dictionary.txt

Thx a ton

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Article by: Swadhin
Introduction of Lists in Python: There are six built-in types of sequences. Lists and tuples are the most common one. In this article we will see how to use Lists in python and how we can utilize it while doing our own program. In general we can al…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

627 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