newbie to python

E

exter_c

Hello,

How do I find out what modules have been included in my python install?
I am having issues with crypt functions not working on ubuntu or redhat
but they work on Slackware.

Any assistance would be great.

Regards,

Johhny.
 
L

Lawrence Oluyede

Il 2005-12-15 said:
How do I find out what modules have been included in my python install?

Look in site-packages directory
I am having issues with crypt functions not working on ubuntu or redhat
but they work on Slackware.

Crypt functions? Are u missing python2.x-crypto package?
 
J

Johhny

Hello,

If I go into the python shell and type help("modules") It does show
that crypt is there. However Im unsure if that means that there is help
or its got the module installed.
From a dpkg --list python* I have

ii python2.4-crypto
2.0+dp1-2ubuntu1 cryptographic
algorithms and protocols for Python

Which means it should work. However Im not really getting anything from
it. Which makes me wonder.
 
L

Lawrence Oluyede

Il 2005-12-15 said:
ii python2.4-crypto
2.0+dp1-2ubuntu1 cryptographic
algorithms and protocols for Python

Which means it should work. However Im not really getting anything from
it. Which makes me wonder.

So, what's not working?
 
J

Johhny

Hello,

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 ?
TypeError: 'module' object is not callable
 
P

Peter Otten

Johhny said:
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
 
J

Johhny

Thankyou, I appreciate your help. I did not realise that python would
behave that way.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top