zauddelig / py-bcrypt

Automatically exported from code.google.com/p/py-bcrypt
Other
0 stars 0 forks source link

ImportError: No module named _bcrypt #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. python
2. import bcrypt

I'v got this output:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "bcrypt/__init__.py", line 26, in <module>
    from _bcrypt import *
ImportError: No module named _bcrypt

What version of the product are you using? On what operating system?
Ubuntu 11.10 
python 2.7

Original issue reported on code.google.com by javiergi...@gmail.com on 8 May 2012 at 9:23

GoogleCodeExporter commented 8 years ago
Install bcrypt and it will work.

Original comment by derrek...@gmail.com on 2 Jun 2012 at 2:00

GoogleCodeExporter commented 8 years ago
Try to run 'python' from another location (not where py-bcrypt was unpacked). 
I had same problem as you, when tried to run from ~/python-install/py-bcrypt-0.2
So I changed to ~ and tried again - everything worked fine :)

Python tries to import bcrypt from source folder 
(~/python-install/py-bcrypt-0.), it has folder bcrypt with __init__.py ...

Original comment by max.li...@gmail.com on 11 Jun 2012 at 3:32

GoogleCodeExporter commented 8 years ago
Had to change "from _bcrypt import *" to "from _bcrypt import hashpw, 
encode_salt" for this module to work with pypy.

Original comment by mason.la...@gmail.com on 24 Nov 2012 at 1:07

GoogleCodeExporter commented 8 years ago
This works for me. Are you running python from a directory that has a "bcrypt" 
subdirectory? That will break things.

Original comment by d...@djm.net.au on 28 Jul 2013 at 12:01

GoogleCodeExporter commented 8 years ago
Does this work on Python 3? I'm on Python 3.3.2 and I'm getting the same error 
message.

Original comment by zwshepp...@gmail.com on 30 Jul 2013 at 5:04

GoogleCodeExporter commented 8 years ago
Nevermind, just found this. Would be nice if this was in the main tree.

For my friends coming here from Google like me: 
https://github.com/wcdolphin/python-bcrypt

Original comment by zwshepp...@gmail.com on 30 Jul 2013 at 5:08

GoogleCodeExporter commented 8 years ago
tip does work from python-3. See 
https://code.google.com/p/py-bcrypt/wiki/ReleaseNotes_0_4 for the release 
that's coming in a week or so.

Original comment by d...@djm.net.au on 30 Jul 2013 at 10:01

GoogleCodeExporter commented 8 years ago
wrt comment #3 - I just tried on pypy (stable and tip, non-JIT) and the module 
(at tip) imported okay but fails. It looks like PyArg_ParseTupleAndKeywords() 
is broken somehow - it returns success but doesn't actually fill in the string 
arguments or their respective lengths.

I'll try again with the JIT version of pypy in case that makes any difference; 
it seems to be what most people use.

Original comment by d...@djm.net.au on 31 Jul 2013 at 2:21

GoogleCodeExporter commented 8 years ago
No change with JIT version. Browsing the pypy code, PyArg_ParseTupleAndKeywords 
is implemented in ./pypy/module/cpyext/src/getargs.c and "s#" arguments are 
supported by convertsimple(). 

I'll file a pypy bug and see what happens.

Original comment by d...@djm.net.au on 31 Jul 2013 at 4:21

GoogleCodeExporter commented 8 years ago
https://bugs.pypy.org/issue1569 filed - it looks like 's#' arg parsing is 
returning garbage on my pypy

Original comment by d...@djm.net.au on 31 Jul 2013 at 4:53

GoogleCodeExporter commented 8 years ago
try apt-get install python2.7-dev

Original comment by george.j...@gmail.com on 9 Jul 2015 at 3:47