473,383 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Beginners help with password program!

This is my first version of this program, im kinda new to python and i was
wondering if someone could help me with this. Their are some errors that i
just cant find, and i want some advice on how to do some of these things
easier. Thanx for the help!
----------------------------------------------------------------------------
from time import sleep

def Sendfile(password, username):
outfile = file(username, "w")
outfile.write(password)
outfile.close()
print "Your are now registered"

def Getfile(username):
infile = file(username, "r")
content = infile.readline(1)
global content
infile.close()
login = input("Are u registered? ")
if login == no:
new_username = input("What do you want for a username, please letters
only: ")
new_password = input("What do you wish for a password: ")
Sendfile(new_password, new_username)
else:
print "Please Login, Enter username, then wait for prompt!"
username = input("Username: ")
sleep(5)
password = input("Password: ")

Getfile(username)
if password != content:
print """Im sorry but you are not a registered user,
If you would like to become a user contact the server admin for
user privelges"""
else:
print "Welcome"
----------------------------------------------------------------------------

When you see the net take the shot
When you miss your shot shoot again
When you make your shot you win!

Just remember
Offense sells tickets
But defense wins championships!

Jul 18 '05 #1
3 3501
On Sat, 26 Jul 2003 18:08:39 -0400 (EDT), tj****@iserv.net wrote:
Their are some errors that i
just cant find,
Please show the errors you get, so we know what you're talking about.
and i want some advice on how to do some of these things easier.


Here's advice on finding errors:

When you encounter an error you don't understand, *don't* try to deal
with the whole program. Take a copy, or make a new program (whichever
seems simpler at the time) and get to the smallest possible program you
can make that still exhibits the error.

This will result in several things:

you may end up solving the error; otherwise:

you may understand the error much better

you will know exactly which lines of code are related to the error

you will have something suitable to post to this newsgroup.

Please don't just post the whole program and say "find my error".
That's *your* task.

--
\ "I watched the Indy 500, and I was thinking that if they left |
`\ earlier they wouldn't have to go so fast." -- Steven Wright |
_o__) |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B
Jul 18 '05 #2
For starters, I suggest you install pychecker and use it on any programs
you create.

Second, every error in python should give you some information as to what
line it occurred on. For example:

: a = b
:Traceback (most recent call last):
: File "<pyshell#29>", line 1, in ?
: a = b
:NameError: name 'b' is not defined

Here it says line 1, because this occurred in Idle. Start by going to that
line... 90% of the time, your error will be right there.

As for your file... well the line if "login == no:" looks wrong, unless
you have a variable named 'no'.. you probably want the string 'no' there.
As was mentioned, you probably won't get much help if you ask people to
debug for you. Debugging is a major part of programming, and you can't
avoid it. So get used to it and get good at it. :D (and learn to test your
code thoroughly). Finally, I recommend you use raw_input(...), rather
than input(...), and then convert the return value from a string to
whatever you need it to be.
Jul 18 '05 #3
For starters, I suggest you install pychecker and use it on any programs
you create.

Second, every error in python should give you some information as to what
line it occurred on. For example:

: a = b
:Traceback (most recent call last):
: File "<pyshell#29>", line 1, in ?
: a = b
:NameError: name 'b' is not defined

Here it says line 1, because this occurred in Idle. Start by going to that
line... 90% of the time, your error will be right there.

As for your file... well the line if "login == no:" looks wrong, unless
you have a variable named 'no'.. you probably want the string 'no' there.
As was mentioned, you probably won't get much help if you ask people to
debug for you. Debugging is a major part of programming, and you can't
avoid it. So get used to it and get good at it. :D (and learn to test your
code thoroughly). Finally, I recommend you use raw_input(...), rather
than input(...), and then convert the return value from a string to
whatever you need it to be.
--
http://mail.python.org/mailman/listinfo/python-list

When you see the net take the shot
When you miss your shot shoot again
When you make your shot you win!

Just remember
Offense sells tickets
But defense wins championships!

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David Nikel | last post by:
I am attempting to create a login script. The following snippet of code: $query = "select * from auth where username='$username' and password=password('$password')"; $result =...
7
by: Will | last post by:
Pardon two post in a row to the newsgroup but I want to try and expedite this, if you guys don't mind helping out... I running Windows XP Pro and wanted to download Python and any additional...
6
by: William Foster | last post by:
Does anyone know of a good online tutorial for C# focused on beginners. I have been to many great sites like csharpfriends, csharp-corner etc looking for good tutorials and have had no luck. Any...
18
by: John Salerno | last post by:
Hi all. I was hoping some of you could recommend a book or two that would help me get started with the basics of C#. I have a slight knowledge of programming, but basically I want to start out like...
9
by: kwindham | last post by:
This program doesn't seem like it should be too hard, but I cannot figure it out. Here is the assignment: Password Verifier - Write a program to verify passwords, satisfying the following...
9
by: iceman4022 | last post by:
Here is a program I have to write for an assignment. I cannot get it to exit when I click cancel and for some reason I get an error when you enter 3 as your option. I am sure it is a beginners...
0
by: Filemaxor | last post by:
I have gotten my code to be able to allow people to add new text to a .txt document and able to call up files so the user can see whats in it. The problem i'm having is getting the for loop to work...
3
by: Michael Schöller | last post by:
Hello, First of all english is not my natural language so please fogive me some bad mistakes in gramatic and use of some vocables :). I have a great problem here. Well I will not use it...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.