newbie to python

Peter Otten __peter__ at web.de
Fri Dec 16 04:43:41 EST 2005


Johhny wrote:

> Here is the script then the problem.
> 
> cat testing.py
> 
> import crypt
> import random, string
> def getsalt(chars = string.letters + string.digits):
>      return random.choice(chars) + random.choice(chars)
> username = raw_input('password : ')
> print crypt.crypt(username,getsalt())
> 
> 
> python testing.py
> password : testing
> Traceback (most recent call last):
>   File "testing.py", line 1, in ?
>     import crypt
>   File "/home/testing/scripts/crypt.py", line 4, in ?

Read carefully. You have a file /home/testing/scripts/crypt.py which is
imported instead of the crypt module in Python's standard library.
Rename /home/testing/scripts/crypt.py to something else, delete
/home/testing/scripts/crypt.pyc, and all should be well.

Peter





More information about the Python-list mailing list