kasunkv / recaptcha

Automatically exported from code.google.com/p/recaptcha
0 stars 0 forks source link

Python: import recaptcha fails #10

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. easy_install recaptcha_client
2. import recaptcha.client
3. Import fails.

Please provide any additional information below.

setup.py's packages list missing declaration for top-level "recaptcha"
package,  as a result recaptcha/__init__.py is not copied to lib/ directory
upon install, and "import recaptcha" fails.

BTW, this is the same issue as here:

http://groups.google.com/group/recaptcha/browse_thread/thread/880d2ba710979b31/9
22791a31555d8c1

Original issue reported on code.google.com by anton.kr...@gtempaccount.com on 17 Jan 2008 at 11:20

GoogleCodeExporter commented 8 years ago
Is it ok that this issue still hasn't been addressed?

Original comment by pavel.sk...@gmail.com on 23 Jun 2008 at 7:19

GoogleCodeExporter commented 8 years ago
The problem seems to be with the packages line in setup.py.  Switching this to 
use
find_packages fixes this issue for me.

Original comment by melk...@gmail.com on 15 Jul 2008 at 6:26

Attachments:

GoogleCodeExporter commented 8 years ago
This kinda sucks.  I'm not the best at python or anything, so maybe I'm missing
something, but for me it was 

easy_install recaptcha-client
#seems to install ok.
>>>import recaptcha
#Fail
import recaptcha.client
#fail
and this goes on.  It is discouraging is all I guess.  I was really excited to 
mess
around with recaptcha today.  Oh well.

Original comment by mwolff...@gmail.com on 16 Jul 2008 at 11:23

GoogleCodeExporter commented 8 years ago
In the mean time, you can also work around this by downloading the tarball, 
untarring
and and doing 'setup.py develop' from within the recaptcha-whatever folder.

This will work as long as you leave the folder laying around (it makes a link 
to the
folder as opposed to creating and installing a broken egg) because the archive
contains the appropriate __init__.py that the installed egg is missing.

Original comment by melk...@gmail.com on 17 Jul 2008 at 1:41

GoogleCodeExporter commented 8 years ago
fixed r102

Original comment by jabron...@gmail.com on 22 Jul 2008 at 6:32

GoogleCodeExporter commented 8 years ago
Missing recaptcha/__init__.py still causes strange behavior for me. Here's an 
example terminal session:

$ mkvirtualenv rcap
New python executable in rcap/bin/python
Installing 
distribute......................................................................
................................................................................
...........................done.
virtualenvwrapper.user_scripts Creating 
/home/andi/.virtualenvs/rcap/bin/predeactivate
virtualenvwrapper.user_scripts Creating 
/home/andi/.virtualenvs/rcap/bin/postdeactivate
virtualenvwrapper.user_scripts Creating 
/home/andi/.virtualenvs/rcap/bin/preactivate
virtualenvwrapper.user_scripts Creating 
/home/andi/.virtualenvs/rcap/bin/postactivate
(rcap)→ andi tmp$ pip install -q recaptcha-client
(rcap)→ andi tmp$ python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import recaptcha
>>> reload(recaptcha)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named recaptcha
>>> 

What makes it really worse is that pylint fails on recaptch imports too. Given 
the following example file:

---demo.py:---
from recaptcha.client import captcha
---END: demo.py---

results in 

pylint -r n ~/tmp/demo.py
No config file found, using default configuration
************* Module demo
C:  1: Missing docstring
F:  1: Unable to import 'recaptcha.client'
W:  1: Unused import captcha

Somehow it seems that "namespace_packages = ['recaptcha']," in setup.py causes 
this behavior.

Original comment by albrecht.andi on 1 Jun 2011 at 10:59

GoogleCodeExporter commented 8 years ago

Original comment by adrian.g...@gmail.com on 30 Mar 2012 at 6:19